You can override the onSubscribe, onNext, onError, onComplete, onSuccess and cancel methods but not the others (this is by design).
The TestObserver implements Disposable for convenience where dispose calls cancel.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static enum | TestObserver.EmptyObserver
An observer that ignores all events and does not report errors. |
| Modifier and Type | Field and Description |
|---|---|
| private final Observer | downstream
The actual observer to forward events to. |
| private QueueDisposable | |
| private final AtomicReference | upstream
Holds the current subscription if any. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | TestObserver(Observer<? super T>
the actual Observer to forward events to downstream)Constructs a forwarding TestObserver. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv final TestObserver | |
| pack-priv final TestObserver | Returns: thisthe expected mode mode)Asserts that the given fusion mode has been established Package-private: avoid leaking the now internal fusion properties into the public API. |
| pack-priv final TestObserver | |
| public final TestObserver | Returns: this;Implements abstract io. |
| public final TestObserver | Returns: thisthe check consumer to run check)Run a check consumer with this TestObserver instance. |
| public final TestObserver | Returns: this;Implements abstract io. |
| public final void | |
| public static < the value type received T> TestObserver | |
| public static < the value type received T> TestObserver | |
| public final void | dispose()
Implements io. |
| pack-priv static String | |
| public final boolean | Returns: true if this TestObserver received a subscriptionReturns true if this TestObserver received a subscription. |
| public final boolean | Returns: true if this TestObserver has been cancelledReturns true if this TestObserver has been cancelled. |
| public final boolean | isDisposed()
Implements io. |
| public void | onComplete()
Implements io. Observable has finished sending push-based notifications.
|
| public void | onError(Throwable
the exception encountered by the Observable t)Implements io. Observable has experienced an error condition.
|
| public void | onNext(T
the item emitted by the Observable t)Implements io. |
| public void | onSubscribe(Disposable
the Disposable instance whose d)Disposable#dispose() can
be called anytime to cancel the connectionImplements io. onNext(Object)) and asynchronous manner.
|
| public void | onSuccess(T
the item emitted by the Maybe value)Implements io. Maybe has finished sending
push-based notifications.
|
| pack-priv final TestObserver | Returns: thisthe mode to establish, see the mode)QueueDisposable constantsSets the initial fusion mode if the upstream supports fusion. |
| downstream | back to summary |
|---|---|
| private final Observer<? super T> downstream The actual observer to forward events to. | |
| qd | back to summary |
|---|---|
| private QueueDisposable<T> qd | |
| upstream | back to summary |
|---|---|
| private final AtomicReference<Disposable> upstream Holds the current subscription if any. | |
| TestObserver | back to summary |
|---|---|
| public TestObserver() Constructs a non-forwarding TestObserver. | |
| TestObserver | back to summary |
|---|---|
| public TestObserver(Observer<? super T> downstream) Constructs a forwarding TestObserver.
| |
| assertFuseable | back to summary |
|---|---|
| pack-priv final TestObserver Assert that the upstream is a fuseable source. Package-private: avoid leaking the now internal fusion properties into the public API. Use ObserverFusion to work with such tests.
| |
| assertFusionMode | back to summary |
|---|---|
| pack-priv final TestObserver Asserts that the given fusion mode has been established Package-private: avoid leaking the now internal fusion properties into the public API. Use ObserverFusion to work with such tests.
| |
| assertNotFuseable | back to summary |
|---|---|
| pack-priv final TestObserver Assert that the upstream is not a fuseable source. Package-private: avoid leaking the now internal fusion properties into the public API. Use ObserverFusion to work with such tests.
| |
| assertNotSubscribed | back to summary |
|---|---|
| public final TestObserver Implements abstract io. Assert that the onSubscribe method hasn't been called at all.
| |
| assertOf | back to summary |
|---|---|
| public final TestObserver Run a check consumer with this TestObserver instance.
| |
| assertSubscribed | back to summary |
|---|---|
| public final TestObserver Implements abstract io. Assert that the onSubscribe method was called exactly once.
| |
| cancel | back to summary |
|---|---|
| public final void cancel() Cancels the TestObserver (before or after the subscription happened). This operation is thread-safe. This method is provided as a convenience when converting Flowable tests that cancel. | |
| create | back to summary |
|---|---|
| public static <T> TestObserver Constructs a non-forwarding TestObserver.
| |
| create | back to summary |
|---|---|
| public static <T> TestObserver Constructs a forwarding TestObserver.
| |
| dispose | back to summary |
|---|---|
| public final void dispose() Implements io. Doc from io. Dispose the resource, the operation should be idempotent.
| |
| fusionModeToString | back to summary |
|---|---|
| pack-priv static String fusionModeToString(int mode) | |
| hasSubscription | back to summary |
|---|---|
| public final boolean hasSubscription() Returns true if this TestObserver received a subscription.
| |
| isCancelled | back to summary |
|---|---|
| public final boolean isCancelled() Returns true if this TestObserver has been cancelled.
| |
| isDisposed | back to summary |
|---|---|
| public final boolean isDisposed() Implements io. Doc from io. Returns true if this resource has been disposed.
| |
| onComplete | back to summary |
|---|---|
| public void onComplete() Implements io. Doc from io. Notifies the Observer that the
The
| |
| onError | back to summary |
|---|---|
| public void onError(Throwable t) Implements io. Doc from io. Notifies the Observer that the
If the | |
| onNext | back to summary |
|---|---|
| public void onNext(T t) Implements io. Doc from io. Provides the Observer with a new item to observe.
The
The
| |
| onSubscribe | back to summary |
|---|---|
| public void onSubscribe(Disposable d) Implements io. Doc from io. Provides the Observer with the means of cancelling (disposing) the
connection (channel) with the Observable in both
synchronous (from within
| |
| onSuccess | back to summary |
|---|---|
| public void onSuccess(T value) Implements io. Doc from io. Notifies the MaybeObserver with one item and that the
The
| |
| setInitialFusionMode | back to summary |
|---|---|
| pack-priv final TestObserver Sets the initial fusion mode if the upstream supports fusion. Package-private: avoid leaking the now internal fusion properties into the public API. Use ObserverFusion to work with such tests.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final TestObserver. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | onComplete()
Implements io. Observable has finished sending push-based notifications.
|
| public void | onError(Throwable
the exception encountered by the Observable t)Implements io. Observable has experienced an error condition.
|
| public void | onNext(Object
the item emitted by the Observable t)Implements io. |
| public void | onSubscribe(Disposable
the Disposable instance whose d)Disposable#dispose() can
be called anytime to cancel the connectionImplements io. onNext(Object)) and asynchronous manner.
|
| public static TestObserver. | |
| public static TestObserver. |
| INSTANCE | back to summary |
|---|---|
| public static final TestObserver. | |
| EmptyObserver | back to summary |
|---|---|
| private EmptyObserver() | |
| onComplete | back to summary |
|---|---|
| public void onComplete() Implements io. Doc from io. Notifies the Observer that the
The
| |
| onError | back to summary |
|---|---|
| public void onError(Throwable t) Implements io. Doc from io. Notifies the Observer that the
If the | |
| onNext | back to summary |
|---|---|
| public void onNext(Object t) Implements io. Doc from io. Provides the Observer with a new item to observe.
The
The | |
| onSubscribe | back to summary |
|---|---|
| public void onSubscribe(Disposable d) Implements io. Doc from io. Provides the Observer with the means of cancelling (disposing) the
connection (channel) with the Observable in both
synchronous (from within
| |
| valueOf | back to summary |
|---|---|
| public static TestObserver. | |
| values | back to summary |
|---|---|
| public static TestObserver. | |