Class/Object

rx.lang.scala.observers

TestSubscriber

Related Docs: object TestSubscriber | package observers

Permalink

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
Visibility
  1. Public
  2. All

Value Members

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

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

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

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

    Permalink

    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

    Permalink

    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

    Permalink
    Definition Classes
    Any
  7. def assertCompleted(): Unit

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  27. def getLastSeenThread: Thread

    Permalink

    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]

    Permalink

    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]

    Permalink

    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

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

    Permalink
    Definition Classes
    Any
  32. final def isUnsubscribed: Boolean

    Permalink

    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

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

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

    Permalink
    Definition Classes
    AnyRef
  36. def onCompleted(): Unit

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

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

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

    Permalink
    Definition Classes
    AnyRef
  45. def toString(): String

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

    Permalink

    Unsubscribe all Subscriptions added to this Subscriber's .

    Unsubscribe all Subscriptions added to this Subscriber's .

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Subscriber[T]

Inherited from Subscription

Inherited from Observer[T]

Inherited from AnyRef

Inherited from Any

Ungrouped