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 public class TestObserver<T> extends java.lang.Object implements Observer<T>
Deprecated.use theTestSubscriberinsteand.Observer usable for unit testing to perform assertions, inspect received events or wrap a mocked Observer.
-
-
Field Summary
Fields Modifier and Type Field Description private Observer<T>delegateDeprecated.private static Observer<java.lang.Object>INERTDeprecated.private java.util.List<Notification<T>>onCompletedEventsDeprecated.private java.util.List<java.lang.Throwable>onErrorEventsDeprecated.private java.util.List<T>onNextEventsDeprecated.
-
Constructor Summary
Constructors Constructor Description TestObserver()Deprecated.TestObserver(Observer<T> delegate)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description (package private) voidassertionError(java.lang.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.voidassertReceivedOnNext(java.util.List<T> items)Deprecated.Assert that a particular sequence of items was received in order.voidassertTerminalEvent()Deprecated.Assert that a single terminal event occurred, eitheronCompleted()oronError(java.lang.Throwable).java.util.List<java.lang.Object>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 theirThrowables, and any sequence-complete notifications will be represented by theirNotificationobjects.java.util.List<Notification<T>>getOnCompletedEvents()Deprecated.Get theNotifications representing each time this observer was notified of sequence completion viaonCompleted(), as aList.java.util.List<java.lang.Throwable>getOnErrorEvents()Deprecated.java.util.List<T>getOnNextEvents()Deprecated.Get the sequence of items observed by this observer, as an orderedList.voidonCompleted()Deprecated.Notifies the Observer that theObservablehas finished sending push-based notifications.voidonError(java.lang.Throwable e)Deprecated.Notifies the Observer that theObservablehas experienced an error condition.voidonNext(T t)Deprecated.Provides the Observer with a new item to observe.
-
-
-
Field Detail
-
onNextEvents
private final java.util.List<T> onNextEvents
Deprecated.
-
onErrorEvents
private final java.util.List<java.lang.Throwable> onErrorEvents
Deprecated.
-
onCompletedEvents
private final java.util.List<Notification<T>> onCompletedEvents
Deprecated.
-
INERT
private static final Observer<java.lang.Object> INERT
Deprecated.
-
-
Method Detail
-
onCompleted
public void onCompleted()
Deprecated.Description copied from interface:ObserverNotifies the Observer that theObservablehas finished sending push-based notifications.The
Observablewill not call this method if it callsObserver.onError(java.lang.Throwable).- Specified by:
onCompletedin interfaceObserver<T>
-
getOnCompletedEvents
public java.util.List<Notification<T>> getOnCompletedEvents()
Deprecated.Get theNotifications 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
public void onError(java.lang.Throwable e)
Deprecated.Description copied from interface:ObserverNotifies the Observer that theObservablehas experienced an error condition.If the
Observablecalls this method, it will not thereafter callObserver.onNext(T)orObserver.onCompleted().
-
getOnErrorEvents
public java.util.List<java.lang.Throwable> getOnErrorEvents()
Deprecated.- Returns:
- a list of Throwables passed to this observer's
onError(java.lang.Throwable)method
-
onNext
public void onNext(T t)
Deprecated.Description copied from interface:ObserverProvides the Observer with a new item to observe.The
Observablemay call this method 0 or more times.The
Observablewill not call this method again after it calls eitherObserver.onCompleted()orObserver.onError(java.lang.Throwable).
-
getOnNextEvents
public java.util.List<T> 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
public java.util.List<java.lang.Object> 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 theirThrowables, and any sequence-complete notifications will be represented by theirNotificationobjects.- Returns:
- a
Listcontaining one item for each item or notification received by this observer, in the order in which they were observed or received
-
assertReceivedOnNext
public void assertReceivedOnNext(java.util.List<T> items)
Deprecated.Assert that a particular sequence of items was received in order.- Parameters:
items- the sequence of items expected to have been observed- Throws:
java.lang.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:
java.lang.AssertionError- if not exactly one terminal event notification was received
-
assertionError
final void assertionError(java.lang.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.- Parameters:
message- the message to use for the error
-
-