AssertableSubscriber is a variety of Subscriber that you can use
for unit testing, to perform assertions or inspect received events.
AssertableSubscriber is a duplicate of TestSubscriber but supports method chaining
where possible.
| Modifier and Type | Field and Description |
|---|---|
| private final TestSubscriber |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public AssertableSubscriber | assertCompleted()
Implements rx. onCompleted signal.
|
| public AssertableSubscriber | assertError(Class<? extends Throwable>
the expected type of the clazz)onError signal receivedImplements rx. onError signal with
the given subclass of a Throwable as type.
|
| public AssertableSubscriber | assertError(Throwable
the Throwable instance expected throwable)Implements rx. onError signal with the
object-equals of the given Throwable instance
|
| public final AssertableSubscriber | assertFailure(Class<? extends Throwable>
the expected Throwable subclass type errorClass, T... the expected values values)Implements rx. |
| public final AssertableSubscriber | assertFailureAndMessage(Class<? extends Throwable>
the expected Throwable subclass type errorClass, String the expected error message returned by message, T... Throwable#getMessage()the expected values values)Implements rx. |
| public AssertableSubscriber | assertNoErrors()
Implements rx. onError signal.
|
| public AssertableSubscriber | assertNotCompleted()
Implements rx. onCompleted signal.
|
| public AssertableSubscriber | assertNoTerminalEvent()
Implements rx. onError or onCompleted signals were received so far.
|
| public AssertableSubscriber | assertNoValues()
Implements rx. onNext signals were received so far.
|
| public AssertableSubscriber | assertReceivedOnNext(List<T>
the List of items expected items)Implements rx. onNext signals
in the same order and with the default null-safe object equals comparison.
|
| public final AssertableSubscriber | assertResult(T...
the values expected values)Implements rx. |
| public AssertableSubscriber | assertTerminalEvent()
Implements rx. onError or onCompleted signal.
|
| public AssertableSubscriber | assertUnsubscribed()
Implements rx. unsubscribe() or by a wrapping
SafeSubscriber.
|
| public AssertableSubscriber | assertValue(T
the single value expected value)Implements rx. |
| public AssertableSubscriber | assertValueCount(int
the expected number of count)onNext signalsImplements rx. onNext signals.
|
| public AssertableSubscriber | assertValues(T...
the expected values values)Implements rx. |
| public final AssertableSubscriber | assertValuesAndClear(T
the first value expected expectedFirstValue, T... the rest of the values expected expectedRestValues)Implements rx. |
| public AssertableSubscriber | awaitTerminalEvent()
Implements rx. onError or {code onCompleted} terminal event indefinitely.
|
| public AssertableSubscriber | awaitTerminalEvent(long
the time to wait for the terminal event timeout, TimeUnit the time unit of the wait time unit)Implements rx. onError or {code onCompleted} terminal event for the given
amount of timeout.
|
| public AssertableSubscriber | awaitTerminalEventAndUnsubscribeOnTimeout(long
the time to wait for the terminal event timeout, TimeUnit the time unit of the wait time unit)Implements rx. onError or {code onCompleted} terminal event for the given
amount of timeout and unsubscribes the sequence if the timeout passed or the
wait itself is interrupted.
|
| public final AssertableSubscriber | awaitValueCount(int
the expected (at least) number of expected, long onNext signalsthe timeout to wait to receive the given number of timeout, TimeUnit onNext eventsthe time unit unit)Implements rx. onNext
signals within the specified timeout period.
|
| public static <T> AssertableSubscriberObservable | |
| public final int | getCompletions()
Implements rx. onCompleted signals received by this Observer.
|
| public Thread | getLastSeenThread()
Implements rx. onNext, onError or
onCompleted methods of this Observer.
|
| public List | getOnErrorEvents()
Implements rx. onError signals.
|
| public List | getOnNextEvents()
Implements rx. onNext events.
|
| public final int | getValueCount()
Implements rx. onNext signals received by this Observer in
a thread-safe manner; one can read up to this number of elements from
the List returned by getOnNextEvents().
|
| public void | onCompleted()
Implements rx. Observable has finished sending push-based notifications.
|
| public void | onError(Throwable
the exception encountered by the Observable e)Implements rx. Observable has experienced an error condition.
|
| public void | onNext(T
the item emitted by the Observable t)Implements rx. |
| public void | onStart()
Overrides rx. Implements rx. onStart method of the underlying Subscriber.
|
| public final AssertableSubscriber | perform(Action0
the action to perform, not null action)Implements rx. |
| public AssertableSubscriber | requestMore(long
the amount requested, non-negative n)Implements rx. |
| public void | setProducer(Producer
the producer to use, not null p)Overrides rx. Implements rx. setProducer method of the underlying Subscriber.
|
| public String |
| ts | back to summary |
|---|---|
| private final TestSubscriber<T> ts | |
| AssertableSubscriberObservable | back to summary |
|---|---|
| public AssertableSubscriberObservable(TestSubscriber<T> ts) | |
| assertCompleted | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer received exaclty one
| |
| assertError | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer received one
| |
| assertError | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer received one
| |
| assertFailure | back to summary |
|---|---|
| public final AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer received the specified items in the given order followed by an error signal of the given type (but no completion signal).
| |
| assertFailureAndMessage | back to summary |
|---|---|
| public final AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer received the specified items in the given order followed by an error signal of the given type and with the exact error message (but no completion signal).
| |
| assertNoErrors | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer has not received any
| |
| assertNotCompleted | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer received no
| |
| assertNoTerminalEvent | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Assert that no
| |
| assertNoValues | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Assert that no
| |
| assertReceivedOnNext | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer received the given list of items as
| |
| assertResult | back to summary |
|---|---|
| public final AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer received the specified items in the given order followed by a completion signal and no errors.
| |
| assertTerminalEvent | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer received either an
| |
| assertUnsubscribed | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer has been unsubscribed via
| |
| assertValue | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer received exactly the given single expected value (compared via null-safe object equals).
| |
| assertValueCount | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer received exactly the given count of
| |
| assertValues | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer received exactly the given expected values (compared via null-safe object equals) in the given order.
| |
| assertValuesAndClear | back to summary |
|---|---|
| public final AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer received exactly the given values (compared via null-safe object equals) and if so, clears the internal buffer of the underlying Subscriber of these values.
| |
| awaitTerminalEvent | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Waits for an
| |
| awaitTerminalEvent | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Waits for an
| |
| awaitTerminalEventAndUnsubscribeOnTimeout | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Waits for an
| |
| awaitValueCount | back to summary |
|---|---|
| public final AssertableSubscriber Implements rx. Doc from rx. Assert that this Observer receives at least the given number of Note that it is possible the AssertionError thrown by this method will contain an actual value >= to the expected one in case there is an emission race or unexpected delay on the emitter side. In this case, increase the timeout amount to avoid false positives.
| |
| create | back to summary |
|---|---|
| public static <T> AssertableSubscriberObservable | |
| getCompletions | back to summary |
|---|---|
| public final int getCompletions() Implements rx. Doc from rx. Returns the number of
| |
| getLastSeenThread | back to summary |
|---|---|
| public Thread getLastSeenThread() Implements rx. Doc from rx. Returns the Thread that has called the last | |
| getOnErrorEvents | back to summary |
|---|---|
| public List Implements rx. Doc from rx. Returns a list of received | |
| getOnNextEvents | back to summary |
|---|---|
| public List Implements rx. Doc from rx. Returns the list of received If the sequence hasn't completed yet and is asynchronous, use the
| |
| getValueCount | back to summary |
|---|---|
| public final int getValueCount() Implements rx. Doc from rx. Returns the number of
| |
| onCompleted | back to summary |
|---|---|
| public void onCompleted() Implements rx. Doc from rx. Notifies the Observer that the
The
| |
| onError | back to summary |
|---|---|
| public void onError(Throwable e) Implements rx. Doc from rx. Notifies the Observer that the
If the | |
| onNext | back to summary |
|---|---|
| public void onNext(T t) Implements rx. Doc from rx. Provides the Observer with a new item to observe.
The
The
| |
| onStart | back to summary |
|---|---|
| public void onStart() Overrides rx. Implements rx. Doc from rx. Allows manually calling the
| |
| perform | back to summary |
|---|---|
| public final AssertableSubscriber Implements rx. Doc from rx. Performs an action given by the Action0 callback in a fluent manner.
| |
| requestMore | back to summary |
|---|---|
| public AssertableSubscriber Implements rx. Doc from rx. Requests the specified amount of items from upstream.
| |
| setProducer | back to summary |
|---|---|
| public void setProducer(Producer p) Overrides rx. Implements rx. Doc from rx. Allows manually calling the | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |