BaseTestConsumer
TestSubscriber and TestObserver.
| Modifier and Type | Field and Description |
|---|---|
| protected boolean | |
| protected long | completions
The number of completions. |
| protected final CountDownLatch | done
The latch that indicates an onError or onComplete has been called. |
| protected final List | errors
The list of errors received. |
| protected Thread | lastThread
The last thread seen by the observer. |
| protected CharSequence | tag
The optional tag associated with this test consumer. |
| protected boolean | timeout
Indicates that one of the |
| protected final List | values
The list of values received. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final U | Returns: thisAssert that this |
| public final U | Returns: thisAssert that the |
| public final U | Returns: thisthe error to check error)Assert that this |
| public final U | Returns: thisthe error errorClass)Class to expectAsserts that this |
| public final U | Returns: thisthe predicate that receives the error errorPredicate)Throwable
and should return true for expected errors.Asserts that this |
| private U | |
| public final U | |
| public final U | Returns: thisAssert that this |
| public final U | Returns: thisAssert that this |
| public final U | Returns: thisAssert that this |
| public final U | Returns: thisthe expected values, asserted in order values)Assert that the upstream signaled the specified values in order and completed normally. |
| protected abstract U | |
| public final U | Returns: thisthe value to expect value)Assert that this |
| public final U | Returns: thisthe predicate that receives the valuePredicate)onNext value
and should return true for the expected value.Asserts that this |
| public final U | Returns: thisthe position to assert on index, T the value to expect value)Asserts that this |
| public final U | Returns: thisthe position to assert on index, @NonNull Predicate<T> the predicate that receives the valuePredicate)onNext value
and should return true for the expected value.Asserts that this |
| public final U | Returns: thisthe expected number of count)onNext eventsAssert that this |
| public final U | Returns: thisthe values expected values)Assert that the |
| public final U | Returns: thisthe sequence of expected values in order sequence)Assert that the |
| public final U | Returns: thisthe values expected values)Assert that the |
| public final U | Returns: thisAwaits until this |
| public final boolean | Returns: true if theTestObserver/TestSubscriber terminated, false if timeout happenedthe waiting time time, @NonNull TimeUnit the time unit of the waiting time unit)Awaits the specified amount of time or until this |
| public final U | Returns: thisthe number of items expected at least atLeast)Await until the |
| public final U | |
| protected abstract void | |
| protected final @NonNull AssertionError | |
| protected abstract boolean | Returns: true if this test consumer was cancelled/disposed.Returns true if this test consumer was cancelled/disposed. |
| public static @NonNull String | Returns: the string representationthe object o)Appends the class name to a non- |
| public final @NonNull List | Returns: a list of received onNext valuesReturns a shared list of received |
| public final U | Returns: thisthe string to display ( tag)null won't print any tag)Set the tag displayed along with an assertion failure's other state information. |
| checkSubscriptionOnce | back to summary |
|---|---|
| protected boolean checkSubscriptionOnce | |
| completions | back to summary |
|---|---|
| protected long completions The number of completions. | |
| done | back to summary |
|---|---|
| protected final CountDownLatch done The latch that indicates an onError or onComplete has been called. | |
| errors | back to summary |
|---|---|
| protected final List<Throwable> errors The list of errors received. | |
| lastThread | back to summary |
|---|---|
| protected Thread lastThread The last thread seen by the observer. | |
| tag | back to summary |
|---|---|
| protected CharSequence tag The optional tag associated with this test consumer.
| |
| timeout | back to summary |
|---|---|
| protected boolean timeout Indicates that one of the
| |
| values | back to summary |
|---|---|
| protected final List<T> values The list of values received. | |
| BaseTestConsumer | back to summary |
|---|---|
| public BaseTestConsumer() Constructs a | |
| assertComplete | back to summary |
|---|---|
| public final U assertComplete() Assert that this
| |
| assertEmpty | back to summary |
|---|---|
| public final U assertEmpty() Assert that the
| |
| assertError | back to summary |
|---|---|
| public final U assertError(@NonNull Throwable error) Assert that this The comparison is performed via
| |
| assertError | back to summary |
|---|---|
| public final U assertError(@NonNull Class<? extends Throwable> errorClass) Asserts that this
| |
| assertError | back to summary |
|---|---|
| public final U assertError(@NonNull Predicate<Throwable> errorPredicate) Asserts that this | |
| assertError | back to summary |
|---|---|
private U assertError(@NonNull Predicate<Throwable> errorPredicate, boolean exact)
| |
| assertFailure | back to summary |
|---|---|
| public final U assertFailure(@NonNull Class<? extends Throwable> error, T... values) Assert that the upstream signaled the specified values in order
and then failed with a specific class or subclass of | |
| assertNoErrors | back to summary |
|---|---|
| public final U assertNoErrors() Assert that this
| |
| assertNotComplete | back to summary |
|---|---|
| public final U assertNotComplete() Assert that this
| |
| assertNoValues | back to summary |
|---|---|
| public final U assertNoValues() Assert that this
| |
| assertResult | back to summary |
|---|---|
| public final U assertResult(T... values) Assert that the upstream signaled the specified values in order and completed normally.
| |
| assertSubscribed | back to summary |
|---|---|
| protected abstract U assertSubscribed() Assert that the
| |
| assertValue | back to summary |
|---|---|
| public final U assertValue(T value) Assert that this
| |
| assertValue | back to summary |
|---|---|
| public final U assertValue(@NonNull Predicate<T> valuePredicate) Asserts that this
| |
| assertValueAt | back to summary |
|---|---|
| public final U assertValueAt(int index, T value) Asserts that this History: 2.1.3 - experimental
| |
| assertValueAt | back to summary |
|---|---|
| public final U assertValueAt(int index, @NonNull Predicate<T> valuePredicate) Asserts that this
| |
| assertValueCount | back to summary |
|---|---|
| public final U assertValueCount(int count) Assert that this
| |
| assertValues | back to summary |
|---|---|
| public final U assertValues(T... values) Assert that the
| |
| assertValueSequence | back to summary |
|---|---|
| public final U assertValueSequence(@NonNull Iterable<? extends T> sequence) Assert that the
| |
| assertValuesOnly | back to summary |
|---|---|
| public final U assertValuesOnly(T... values) Assert that the History: 2.1.4 - experimental
| |
| await | back to summary |
|---|---|
| public final U await() throws InterruptedException Awaits until this
| |
| await | back to summary |
|---|---|
| public final boolean await(long time, @NonNull TimeUnit unit) throws InterruptedException Awaits the specified amount of time or until this
| |
| awaitCount | back to summary |
|---|---|
| public final U awaitCount(int atLeast) Await until the History: 2.0.7 - experimental
| |
| awaitDone | back to summary |
|---|---|
| public final U awaitDone(long time, @NonNull TimeUnit unit) Awaits until the internal latch is counted down. If the wait times out or gets interrupted, the
| |
| dispose | back to summary |
|---|---|
| protected abstract void dispose() Cancel/dispose this test consumer. | |
| fail | back to summary |
|---|---|
| protected final @NonNull AssertionError fail(@NonNull String message) Fail with the given message and add the sequence of errors as suppressed ones. Note this is deliberately the only fail method. Most of the times an assertion would fail but it is possible it was due to an exception somewhere. This construct will capture those potential errors and report it along with the original failure.
| |
| isDisposed | back to summary |
|---|---|
| protected abstract boolean isDisposed() Returns true if this test consumer was cancelled/disposed.
| |
| valueAndClass | back to summary |
|---|---|
| public static @NonNull String valueAndClass(@Nullable Object o) Appends the class name to a non- | |
| values | back to summary |
|---|---|
| public final @NonNull List Returns a shared list of received
Note that accessing the items via certain methods of the
The
A view of the returned List can be created via | |
| withTag | back to summary |
|---|---|
| public final U withTag(@Nullable CharSequence tag) Set the tag displayed along with an assertion failure's other state information. History: 2.0.7 - experimental
| |