Skip to content

Commit 075acce

Browse files
committed
assert exact same exception
1 parent 070cc37 commit 075acce

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/test/groovy/ch/petikoch/examples/mvvm_rxjava/utils/AsyncUtilsTest.groovy

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,19 @@ class AsyncUtilsTest extends Specification {
7373
}
7474

7575
def 'executeAsync: propagates exceptions'() {
76+
given:
77+
def evilExceptionAtRuntime = new RuntimeException("Boom!")
78+
7679
when:
7780
Single<FinishedIndicator> result = AsyncUtils.executeAsync {
78-
throw new RuntimeException("Boom!")
81+
throw evilExceptionAtRuntime
7982
}
8083
result.subscribe(testSubscriber)
8184
awaitUntil { !testSubscriber.getOnErrorEvents().isEmpty() }
8285

8386
then:
84-
testSubscriber.assertError(RuntimeException)
87+
testSubscriber.getOnErrorEvents().size() == 1
88+
testSubscriber.getOnErrorEvents().get(0).is(evilExceptionAtRuntime)
8589
testSubscriber.assertNoValues()
8690
}
8791

0 commit comments

Comments
 (0)