rx.lang.scala.observers

TestSubscriber

Related Docs: object TestSubscriber | package observers

class TestSubscriber[T] extends Subscriber[T]

A TestSubscriber is a variety of Subscriber that you can use for unit testing, to perform assertions, inspect received events, or wrap a mocked Subscriber.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. TestSubscriber
  2. Subscriber
  3. Subscription
  4. Observer
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def add(u: ⇒ Unit): Unit

    Create a Subscription using u and add it to this Subscriber's list of Subscriptions if this list is not marked as unsubscribed.

    Create a Subscription using u and add it to this Subscriber's list of Subscriptions if this list is not marked as unsubscribed. If the list **is** marked as unsubscribed, it will call u.

    u

    callback to run when unsubscribed

    Definition Classes
    Subscriber
  5. final def add(s: Subscription): Unit

    Add a Subscription to this Subscriber's list of Subscriptions if this list is not marked as unsubscribed.

    Add a Subscription to this Subscriber's list of Subscriptions if this list is not marked as unsubscribed. If the list **is** marked as unsubscribed, it will unsubscribe the new Subscription as well.

    s

    the Subscription to add

    Definition Classes
    Subscriber
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def assertCompleted(): Unit

    EXPERIMENTAL Assert if there is exactly a single completion event.

    EXPERIMENTAL Assert if there is exactly a single completion event.

    Annotations
    @Experimental() @throws( ... )
    Since

    (if this graduates from "Experimental" replace this parenthetical with the release number)

    Exceptions thrown

    java.lang.AssertionError if there were zero, or more than one, onCompleted events

  8. def assertError(throwable: Throwable): Unit

    EXPERIMENTAL Assert there is a single onError event with the exact exception.

    EXPERIMENTAL Assert there is a single onError event with the exact exception.

    throwable

    the throwable to check

    Annotations
    @Experimental() @throws( ... )
    Since

    (if this graduates from "Experimental" replace this parenthetical with the release number)

    Exceptions thrown

    java.lang.AssertionError if there were zero, or more than one, onError events, or if the single onError event did not carry an error that matches the specified throwable

  9. def assertError(clazz: Class[_ <: Throwable]): Unit

    EXPERIMENTAL Assert if there is exactly one error event which is a subclass of the given class.

    EXPERIMENTAL Assert if there is exactly one error event which is a subclass of the given class.

    clazz

    the class to check the error against.

    Annotations
    @Experimental() @throws( ... )
    Since

    (if this graduates from "Experimental" replace this parenthetical with the release number)

    Exceptions thrown

    java.lang.AssertionError if there were zero, or more than one, onError events, or if the single onError event did not carry an error of a subclass of the given class

  10. def assertNoErrors(): Unit

    Assert that this Subscriber has received no onError notifications.

    Assert that this Subscriber has received no onError notifications.

    Annotations
    @throws( ... )
    Exceptions thrown

    java.lang.AssertionError if this Subscriber has received one or more onError notifications

  11. def assertNoTerminalEvent(): Unit

    EXPERIMENTAL Assert for no onError and onCompleted events.

    EXPERIMENTAL Assert for no onError and onCompleted events.

    Annotations
    @Experimental() @throws( ... )
    Since

    (if this graduates from "Experimental" replace this parenthetical with the release number)

    Exceptions thrown

    java.lang.AssertionError if there was either an onError or onCompleted event

  12. def assertNoValues(): Unit

    EXPERIMENTAL Assert if there are no onNext events received.

    EXPERIMENTAL Assert if there are no onNext events received.

    Annotations
    @Experimental() @throws( ... )
    Since

    (if this graduates from "Experimental" replace this parenthetical with the release number)

    Exceptions thrown

    java.lang.AssertionError if there were any onNext events

  13. def assertNotCompleted(): Unit

    EXPERIMENTAL Assert if there is no completion event.

    EXPERIMENTAL Assert if there is no completion event.

    Annotations
    @Experimental() @throws( ... )
    Since

    (if this graduates from "Experimental" replace this parenthetical with the release number)

    Exceptions thrown

    java.lang.AssertionError if there were one or more than one onCompleted events

  14. def assertTerminalEvent(): Unit

    Assert that a single terminal event occurred, either onCompleted or onError.

    Assert that a single terminal event occurred, either onCompleted or onError.

    Annotations
    @throws( ... )
    Exceptions thrown

    java.lang.AssertionError if not exactly one terminal event notification was received

  15. def assertUnsubscribed(): Unit

    Assert that this Subscriber is unsubscribed.

    Assert that this Subscriber is unsubscribed.

    Annotations
    @throws( ... )
    Exceptions thrown

    java.lang.AssertionError if this Subscriber is not unsubscribed

  16. def assertValue(value: T): Unit

    EXPERIMENTAL Assert if there is only a single received onNext event and that it marks the emission of a specific item.

    EXPERIMENTAL Assert if there is only a single received onNext event and that it marks the emission of a specific item.

    value

    the item to check

    Annotations
    @Experimental() @throws( ... )
    Since

    (if this graduates from "Experimental" replace this parenthetical with the release number)

    Exceptions thrown

    java.lang.AssertionError if the Observable does not emit only the single item specified by value

  17. def assertValueCount(count: Int): Unit

    EXPERIMENTAL Assert if the given number of onNext events are received.

    EXPERIMENTAL Assert if the given number of onNext events are received.

    count

    the expected number of onNext events

    Annotations
    @Experimental() @throws( ... )
    Since

    (if this graduates from "Experimental" replace this parenthetical with the release number)

    Exceptions thrown

    java.lang.AssertionError if there were more or fewer onNext events than specified by count

  18. def assertValues(values: T*): Unit

    EXPERIMENTAL Assert if the received onNext events, in order, are the specified items.

    EXPERIMENTAL Assert if the received onNext events, in order, are the specified items.

    values

    the items to check

    Annotations
    @Experimental() @throws( ... )
    Since

    (if this graduates from "Experimental" replace this parenthetical with the release number)

    Exceptions thrown

    java.lang.AssertionError if the items emitted do not exactly match those specified by values

  19. def awaitTerminalEvent(timeout: Duration): Unit

    Blocks until this Subscriber receives a notification that the Observable is complete (either an onCompleted or onError notification), or until a timeout expires.

    Blocks until this Subscriber receives a notification that the Observable is complete (either an onCompleted or onError notification), or until a timeout expires.

    timeout

    the duration of the timeout

    Annotations
    @throws( ... )
    Exceptions thrown

    java.lang.RuntimeException if the Subscriber is interrupted before the Observable is able to complete

  20. def awaitTerminalEvent(): Unit

    Blocks until this Subscriber receives a notification that the Observable is complete (either an onCompleted or onError notification).

    Blocks until this Subscriber receives a notification that the Observable is complete (either an onCompleted or onError notification).

    Annotations
    @throws( ... )
    Exceptions thrown

    java.lang.RuntimeException if the Subscriber is interrupted before the Observable is able to complete

  21. def awaitTerminalEventAndUnsubscribeOnTimeout(timeout: Duration): Unit

    Blocks until this Subscriber receives a notification that the Observable is complete (either an onCompleted or onError notification), or until a timeout expires; if the Subscriber is interrupted before either of these events take place, this method unsubscribes the Subscriber from the Observable).

    Blocks until this Subscriber receives a notification that the Observable is complete (either an onCompleted or onError notification), or until a timeout expires; if the Subscriber is interrupted before either of these events take place, this method unsubscribes the Subscriber from the Observable).

    timeout

    the duration of the timeout

  22. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  24. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  25. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  26. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  27. def getLastSeenThread: Thread

    Returns the last thread that was in use when an item or notification was received by this Subscriber.

    Returns the last thread that was in use when an item or notification was received by this Subscriber.

    returns

    the Thread on which this Subscriber last received an item or notification from the Observable it is subscribed to

  28. def getOnErrorEvents: Seq[Throwable]

    Get the Throwables this Subscriber was notified of via onError

    Get the Throwables this Subscriber was notified of via onError

    returns

    a sequence of the Throwables that were passed to the Subscriber.onError method

  29. def getOnNextEvents: Seq[T]

    Get the sequence of items observed by this Subscriber.

    Get the sequence of items observed by this Subscriber.

    returns

    a sequence of items observed by this Subscriber, in the order in which they were observed

  30. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  31. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  32. final def isUnsubscribed: Boolean

    Indicates whether this Subscriber has unsubscribed from its list of Subscriptions.

    Indicates whether this Subscriber has unsubscribed from its list of Subscriptions.

    returns

    true if this Subscriber has unsubscribed from its Subscriptions, false otherwise

    Definition Classes
    SubscriberSubscription
  33. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  34. final def notify(): Unit

    Definition Classes
    AnyRef
  35. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  36. def onCompleted(): Unit

    Notifies the Observer that the rx.lang.scala.Observable has finished sending push-based notifications.

    Notifies the Observer that the rx.lang.scala.Observable has finished sending push-based notifications.

    The rx.lang.scala.Observable will not call this method if it calls onError.

    Definition Classes
    TestSubscriberObserver
  37. def onError(error: Throwable): Unit

    Notifies the Observer that the rx.lang.scala.Observable has experienced an error condition.

    Notifies the Observer that the rx.lang.scala.Observable has experienced an error condition.

    If the rx.lang.scala.Observable calls this method, it will not thereafter call onNext or onCompleted.

    Definition Classes
    TestSubscriberObserver
  38. def onNext(value: T): Unit

    Provides the Observer with new data.

    Provides the Observer with new data.

    The rx.lang.scala.Observable calls this closure 0 or more times.

    The rx.lang.scala.Observable will not call this method again after it calls either onCompleted or onError.

    Definition Classes
    TestSubscriberObserver
  39. def onStart(): Unit

    This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber.

    This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber. Override this method to add any useful initialization to your subscription, for instance to initiate backpressure.

    Observable.just(1, 2, 3).subscribe(new Subscriber[Int]() {
      override def onStart(): Unit = request(1)
      override def onNext(v: Int): Unit = {
        println(v)
        request(1)
      }
      override def onError(e: Throwable): Unit = e.printStackTrace()
      override def onCompleted(): Unit = {}
    })
    Definition Classes
    Subscriber
  40. final def request(n: Long): Unit

    Request a certain maximum number of emitted items from the Observable this Subscriber is subscribed to.

    Request a certain maximum number of emitted items from the Observable this Subscriber is subscribed to. This is a way of requesting backpressure. To disable backpressure, pass Long.MaxValue to this method.

    n

    the maximum number of items you want the Observable to emit to the Subscriber at this time, or Long.MaxValue if you want the Observable to emit items at its own pace

    Attributes
    protected[this]
    Definition Classes
    Subscriber
  41. def requestMore(n: Long): Unit

    Allow calling the protected request from unit tests.

    Allow calling the protected request from unit tests.

    n

    the maximum number of items you want the Observable to emit to the Subscriber at this time, or Long.MaxValue if you want the Observable to emit items at its own pace

  42. def setProducer(producer: (Long) ⇒ Unit): Unit

    Definition Classes
    Subscriber
  43. def setProducer(producer: Producer): Unit

    Definition Classes
    Subscriber
  44. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  45. def toString(): String

    Definition Classes
    AnyRef → Any
  46. final def unsubscribe(): Unit

    Unsubscribe all Subscriptions added to this Subscriber's .

    Unsubscribe all Subscriptions added to this Subscriber's .

    Definition Classes
    SubscriberSubscription
  47. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Subscriber[T]

Inherited from Subscription

Inherited from Observer[T]

Inherited from AnyRef

Inherited from Any

Ungrouped