rx.lang.scala.observers

TestSubscriber

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: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

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

    Definition Classes
    Any
  6. 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
  7. 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
  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. 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

  10. 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

  11. 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

  12. 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

  13. 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

  14. 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

  15. 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

  16. 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

  17. 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

  18. 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

  19. 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

  20. 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

  21. 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

  22. 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

  23. 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

  24. def clone(): AnyRef

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

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

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

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

    Definition Classes
    AnyRef → Any
  29. 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

  30. 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

  31. 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

  32. def hashCode(): Int

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

    Definition Classes
    Any
  34. 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
  35. final def ne(arg0: AnyRef): Boolean

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

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

    Definition Classes
    AnyRef
  38. 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
  39. 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
  40. 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
  41. 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
  42. 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
  43. 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

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

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

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

    Definition Classes
    AnyRef
  47. def toString(): String

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

    Unsubscribe all Subscriptions added to this Subscriber's .

    Unsubscribe all Subscriptions added to this Subscriber's .

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  51. 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