Skip to content

Commit

Permalink
Fixed library tests
Browse files Browse the repository at this point in the history
According to the below link some test assertions are now not available. Made substitute extensions.
ReactiveX/RxJava#6526
  • Loading branch information
dariuszseweryn authored and Drjacky committed Sep 7, 2021
1 parent e640ff2 commit 3d755bc
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,26 @@ class TestSubscriberExtension {
subscriber.assertValueSequence(values)
}

static <T> void assertTerminated(final TestObserver<T> subscriber) {
try {
subscriber.assertComplete()
} catch (Throwable ignored) {
subscriber.assertError({ true })
}
}

static <T> void assertNotTerminated(final TestObserver<T> subscriber) {
subscriber.assertNotComplete()
subscriber.assertNoErrors()
if (subscriber.isDisposed()) {
throw AssertionError("TestObserver is disposed")
}
}

static <T> void assertErrorMessage(final TestObserver<T> subscriber, final String errorMessage) {
subscriber.assertError { it.message == errorMessage }
}

static boolean assertAllBatchesSmaller(final TestSubscriber<byte[]> subscriber, int maxBatchSize) {
def emittedValues = subscriber.values()
def size = emittedValues.size()
Expand Down

0 comments on commit 3d755bc

Please sign in to comment.