Package rx.observers

Class 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 the TestSubscriber insteand.
    Observer usable for unit testing to perform assertions, inspect received events or wrap a mocked Observer.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      (package private) 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.
      void assertReceivedOnNext​(java.util.List<T> items)
      Deprecated.
      Assert that a particular sequence of items was received in order.
      void assertTerminalEvent()
      Deprecated.
      Assert that a single terminal event occurred, either onCompleted() or onError(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 their Throwables, and any sequence-complete notifications will be represented by their Notification objects.
      java.util.List<Notification<T>> getOnCompletedEvents()
      Deprecated.
      Get the Notifications representing each time this observer was notified of sequence completion via onCompleted(), as a List.
      java.util.List<java.lang.Throwable> getOnErrorEvents()
      Deprecated.
      Get the Throwables this observer was notified of via onError(java.lang.Throwable) as a List.
      java.util.List<T> getOnNextEvents()
      Deprecated.
      Get the sequence of items observed by this observer, as an ordered List.
      void onCompleted()
      Deprecated.
      Notifies the Observer that the Observable has finished sending push-based notifications.
      void onError​(java.lang.Throwable e)
      Deprecated.
      Notifies the Observer that the Observable has experienced an error condition.
      void onNext​(T t)
      Deprecated.
      Provides the Observer with a new item to observe.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • delegate

        private final Observer<T> delegate
        Deprecated.
      • 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.
    • Constructor Detail

      • TestObserver

        public TestObserver​(Observer<T> delegate)
        Deprecated.
      • TestObserver

        public TestObserver()
        Deprecated.
    • Method Detail

      • getOnCompletedEvents

        public java.util.List<Notification<T>> getOnCompletedEvents()
        Deprecated.
        Get the Notifications representing each time this observer was notified of sequence completion via onCompleted(), as a List.
        Returns:
        a list of Notifications representing calls to this observer's onCompleted() method
      • getOnNextEvents

        public java.util.List<T> getOnNextEvents()
        Deprecated.
        Get the sequence of items observed by this observer, as an ordered List.
        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 their Throwables, and any sequence-complete notifications will be represented by their Notification 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

        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 match items
      • assertTerminalEvent

        public void assertTerminalEvent()
        Deprecated.
        Assert that a single terminal event occurred, either onCompleted() or onError(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