Package rx.observers
Class TestObserver<T>
java.lang.Object
rx.observers.TestObserver<T>
- Type Parameters:
T
- the observed value type
- All Implemented Interfaces:
Observer<T>
Deprecated.
Observer usable for unit testing to perform assertions, inspect received events or wrap a mocked Observer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionDeprecated.Deprecated.private final List
<Notification<T>> Deprecated.Deprecated.Deprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final void
assertionError
(String message) Deprecated.Combines an assertion error message with the current completion and error state of this TestSubscriber, giving more information when some assertXXX check fails.void
assertReceivedOnNext
(List<T> items) Deprecated.Assert that a particular sequence of items was received in order.void
Deprecated.Assert that a single terminal event occurred, eitheronCompleted()
oronError(java.lang.Throwable)
.Deprecated.Get a list containing all of the items and notifications received by this observer, where the items will be given as-is, any error notifications will be represented by theirThrowable
s, and any sequence-complete notifications will be represented by theirNotification
objects.Deprecated.Get theNotification
s representing each time this observer was notified of sequence completion viaonCompleted()
, as aList
.Deprecated.Deprecated.Get the sequence of items observed by this observer, as an orderedList
.void
Deprecated.Notifies the Observer that theObservable
has finished sending push-based notifications.void
Deprecated.Notifies the Observer that theObservable
has experienced an error condition.void
Deprecated.Provides the Observer with a new item to observe.
-
Field Details
-
delegate
Deprecated. -
onNextEvents
Deprecated. -
onErrorEvents
Deprecated. -
onCompletedEvents
Deprecated. -
INERT
Deprecated.
-
-
Constructor Details
-
TestObserver
Deprecated. -
TestObserver
public TestObserver()Deprecated.
-
-
Method Details
-
onCompleted
public void onCompleted()Deprecated.Description copied from interface:Observer
Notifies the Observer that theObservable
has finished sending push-based notifications.The
Observable
will not call this method if it callsObserver.onError(java.lang.Throwable)
.- Specified by:
onCompleted
in interfaceObserver<T>
-
getOnCompletedEvents
Deprecated.Get theNotification
s representing each time this observer was notified of sequence completion viaonCompleted()
, as aList
.- Returns:
- a list of Notifications representing calls to this observer's
onCompleted()
method
-
onError
Deprecated.Description copied from interface:Observer
Notifies the Observer that theObservable
has experienced an error condition.If the
Observable
calls this method, it will not thereafter callObserver.onNext(T)
orObserver.onCompleted()
. -
getOnErrorEvents
Deprecated.- Returns:
- a list of Throwables passed to this observer's
onError(java.lang.Throwable)
method
-
onNext
Deprecated.Description copied from interface:Observer
Provides the Observer with a new item to observe.The
Observable
may call this method 0 or more times.The
Observable
will not call this method again after it calls eitherObserver.onCompleted()
orObserver.onError(java.lang.Throwable)
. -
getOnNextEvents
Deprecated.Get the sequence of items observed by this observer, as an orderedList
.- Returns:
- a list of items observed by this observer, in the order in which they were observed
-
getEvents
Deprecated.Get a list containing all of the items and notifications received by this observer, where the items will be given as-is, any error notifications will be represented by theirThrowable
s, and any sequence-complete notifications will be represented by theirNotification
objects.- Returns:
- a
List
containing one item for each item or notification received by this observer, in the order in which they were observed or received
-
assertReceivedOnNext
Deprecated.Assert that a particular sequence of items was received in order.- Parameters:
items
- the sequence of items expected to have been observed- Throws:
AssertionError
- if the sequence of items observed does not exactly matchitems
-
assertTerminalEvent
public void assertTerminalEvent()Deprecated.Assert that a single terminal event occurred, eitheronCompleted()
oronError(java.lang.Throwable)
.- Throws:
AssertionError
- if not exactly one terminal event notification was received
-
assertionError
Deprecated.Combines an assertion error message with the current completion and error state of this TestSubscriber, giving more information when some assertXXX check fails.- Parameters:
message
- the message to use for the error
-
TestSubscriber
insteand.