File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
src/test/kotlin/in/rcard/assertj/arrowcore Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change 11package `in`.rcard.assertj.arrowcore
22
3+ import `in`.rcard.assertj.arrowcore.Dummy.aFunctionThatRaisesAnError
4+ import `in`.rcard.assertj.arrowcore.Dummy.aFunctionThatThrowsAnException
5+ import `in`.rcard.assertj.arrowcore.Dummy.aFunctionWithContext
6+ import `in`.rcard.assertj.arrowcore.RaiseAssert.Companion.assertThat
7+ import `in`.rcard.assertj.arrowcore.errors.RaiseShouldSucceedButFailed.Companion.shouldSucceedButFailed
8+ import org.assertj.core.api.Assertions
39import org.junit.jupiter.api.Test
410
511internal class RaiseAssert_result_Test {
612 @Test
7- fun `should return a valid Object Assert if the Raise returns a result` () {
8- TODO ( " Not yet implemented " )
13+ internal fun `should return a valid Object Assert if the Raise returns a result` () {
14+ assertThat { aFunctionWithContext( 42 ) }.result().isEqualTo( 42 )
915 }
1016
1117 @Test
12- fun `should fails if the Raise raised an error` () {
13- TODO (" Not yet implemented" )
18+ internal fun `should fails if the Raise raised an error` () {
19+ Assertions
20+ .assertThatThrownBy { assertThat { aFunctionThatRaisesAnError() }.result() }
21+ .isInstanceOf(AssertionError ::class .java)
22+ .hasMessage(shouldSucceedButFailed(" LOGICAL ERROR" ).create())
23+ }
24+
25+ @Test
26+ internal fun `should rethrow the inner exception` () {
27+ Assertions
28+ .assertThatThrownBy { assertThat { aFunctionThatThrowsAnException() }.result() }
29+ .isInstanceOf(RuntimeException ::class .java)
30+ .hasMessage(" AN EXCEPTION" )
1431 }
1532}
You can’t perform that action at this time.
0 commit comments