Class/Object

akka.actor.testkit.typed.javadsl

TestProbe

Related Docs: object TestProbe | package javadsl

Permalink

abstract class TestProbe[M] extends AnyRef

Java API: * Create instances through the create factories in the TestProbe companion or via ActorTestKit#createTestProbe.

A test probe is essentially a queryable mailbox which can be used in place of an actor and the received messages can then be asserted etc.

Not for user extension

Annotations
@DoNotInherit()
Source
TestProbe.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TestProbe
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TestProbe()

    Permalink

Abstract Value Members

  1. abstract def awaitAssert[A](max: Duration, interval: Duration, supplier: Supplier[A]): A

    Permalink

    Evaluate the given assert every interval until it does not throw an exception and return the result.

    Evaluate the given assert every interval until it does not throw an exception and return the result.

    If the max timeout expires the last exception is thrown.

    Note that the timeout is scaled using Duration.dilated, which uses the configuration entry "akka.test.timefactor".

  2. abstract def expectMessage[T <: M](max: Duration, hint: String, obj: T): T

    Permalink

    Receive one message from the test actor and assert that it equals the given object.

    Receive one message from the test actor and assert that it equals the given object. Wait time is bounded by the given duration, with an AssertionError being thrown in case of timeout.

    returns

    the received object

  3. abstract def expectMessage[T <: M](max: Duration, obj: T): T

    Permalink

    Receive one message from the test actor and assert that it equals the given object.

    Receive one message from the test actor and assert that it equals the given object. Wait time is bounded by the given duration, with an AssertionError being thrown in case of timeout.

    returns

    the received object

  4. abstract def expectMessage[T <: M](obj: T): T

    Permalink

    Same as expectMessage(remainingOrDefault, obj), but correctly treating the timeFactor.

  5. abstract def expectMessageClass_internal[C](max: FiniteDuration, c: Class[C]): C

    Permalink

    INTERNAL API

    INTERNAL API

    Attributes
    protected
    Annotations
    @InternalApi()
  6. abstract def expectNoMessage(): Unit

    Permalink

    Assert that no message is received.

    Assert that no message is received. Waits for the default period configured as akka.actor.testkit.typed.expect-no-message-default That value is dilated.

  7. abstract def expectNoMessage(max: Duration): Unit

    Permalink

    Assert that no message is received for the specified time.

    Assert that no message is received for the specified time. Supplied value is not dilated.

  8. abstract def expectTerminated[U](actorRef: typed.ActorRef[U], max: Duration): Unit

    Permalink

    Expect the given actor to be stopped or stop within the given timeout or throw an AssertionError.

  9. abstract def fishForMessage_internal(max: FiniteDuration, hint: String, fisher: (M) ⇒ FishingOutcome): List[M]

    Permalink

    INTERNAL API

    INTERNAL API

    Attributes
    protected
    Annotations
    @InternalApi()
  10. abstract def getRemaining: Duration

    Permalink

    Obtain time remaining for execution of the innermost enclosing within block or throw an AssertionError if no within block surrounds this call.

  11. abstract def getRemainingOr(duration: Duration): Duration

    Permalink

    Obtain time remaining for execution of the innermost enclosing within block or missing that it returns the given duration.

  12. abstract def getRemainingOrDefault: Duration

    Permalink

    Obtain time remaining for execution of the innermost enclosing within block or missing that it returns the properly dilated default for this case from settings (key "akka.actor.testkit.typed.single-expect-default").

  13. abstract def ref: typed.ActorRef[M]

    Permalink

    ActorRef for this TestProbe

  14. implicit abstract def settings: TestKitSettings

    Permalink
    Attributes
    protected
  15. abstract def within_internal[T](min: FiniteDuration, max: FiniteDuration, f: ⇒ T): T

    Permalink

    INTERNAL API

    INTERNAL API

    Attributes
    protected
    Annotations
    @InternalApi()

Concrete Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestProbe[M] to any2stringadd[TestProbe[M]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (TestProbe[M], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestProbe[M] to ArrowAssoc[TestProbe[M]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def awaitAssert[A](supplier: Supplier[A]): A

    Permalink

    Evaluate the given assert every 100 milliseconds until it does not throw an exception and return the result.

    Evaluate the given assert every 100 milliseconds until it does not throw an exception and return the result. A max time is taken it from the innermost enclosing within block.

  8. def awaitAssert[A](max: Duration, supplier: Supplier[A]): A

    Permalink

    Evaluate the given assert every 100 milliseconds until it does not throw an exception and return the result.

    Evaluate the given assert every 100 milliseconds until it does not throw an exception and return the result.

    If the max timeout expires the last exception is thrown.

    Note that the timeout is scaled using Duration.dilated, which uses the configuration entry "akka.test.timefactor".

  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def ensuring(cond: (TestProbe[M]) ⇒ Boolean, msg: ⇒ Any): TestProbe[M]

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestProbe[M] to Ensuring[TestProbe[M]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: (TestProbe[M]) ⇒ Boolean): TestProbe[M]

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestProbe[M] to Ensuring[TestProbe[M]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean, msg: ⇒ Any): TestProbe[M]

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestProbe[M] to Ensuring[TestProbe[M]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: Boolean): TestProbe[M]

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestProbe[M] to Ensuring[TestProbe[M]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  16. def expectMessageClass[T](clazz: Class[T], max: Duration): T

    Permalink

    Wait for a message of type M and return it when it arrives, or fail if the max timeout is hit.

    Wait for a message of type M and return it when it arrives, or fail if the max timeout is hit. The timeout is dilated.

  17. def expectMessageClass[T](clazz: Class[T]): T

    Permalink

    Same as expectMessageType(clazz, remainingOrDefault), but correctly treating the timeFactor.

  18. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. def fishForMessage(max: Duration, hint: String, fisher: Function[M, FishingOutcome]): List[M]

    Permalink

    Same as the other fishForMessageJava but includes the provided hint in all error messages

  20. def fishForMessage(max: Duration, fisher: Function[M, FishingOutcome]): List[M]

    Permalink

    Java API: Allows for flexible matching of multiple messages within a timeout, the fisher function is fed each incoming message, and returns one of the following effects to decide on what happens next:

    Java API: Allows for flexible matching of multiple messages within a timeout, the fisher function is fed each incoming message, and returns one of the following effects to decide on what happens next:

    * FishingOutcomes.continue() - continue with the next message given that the timeout has not been reached * FishingOutcomes.complete() - successfully complete and return the message * FishingOutcomes.fail(errorMsg) - fail the test with a custom message

    Additionally failures includes the list of messages consumed. If a message of type M but not of type T is received this will also fail the test, additionally if the fisher function throws a match error the error is decorated with some fishing details and the test is failed (making it convenient to use this method with a partial function).

    max

    Max total time without the fisher function returning CompleteFishing before failing The timeout is dilated.

    returns

    The messages accepted in the order they arrived

  21. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestProbe[M] to StringFormat[TestProbe[M]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. def getRef(): typed.ActorRef[M]

    Permalink

    ActorRef for this TestProbe

  24. def hashCode(): Int

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

    Permalink
    Definition Classes
    Any
  26. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  29. final def synchronized[T0](arg0: ⇒ T0): T0

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

    Permalink
    Definition Classes
    AnyRef → Any
  31. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. def within[T](max: Duration)(f: Supplier[T]): T

    Permalink

    Same as calling within(0 seconds, max)(f).

  35. def within[T](min: Duration, max: Duration)(f: Supplier[T]): T

    Permalink

    Execute code block while bounding its execution time between min and max.

    Execute code block while bounding its execution time between min and max. within blocks may be nested. All methods in this trait which take maximum wait times are available in a version which implicitly uses the remaining time governed by the innermost enclosing within block.

    Note that the timeout is scaled using Duration.dilated, which uses the configuration entry "akka.actor.testkit.typed.timefactor", while the min Duration is not.

    val ret = within(50 millis) {
      test ! Ping
      expectMessageType[Pong]
    }
  36. def [B](y: B): (TestProbe[M], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestProbe[M] to ArrowAssoc[TestProbe[M]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from TestProbe[M] to any2stringadd[TestProbe[M]]

Inherited by implicit conversion StringFormat from TestProbe[M] to StringFormat[TestProbe[M]]

Inherited by implicit conversion Ensuring from TestProbe[M] to Ensuring[TestProbe[M]]

Inherited by implicit conversion ArrowAssoc from TestProbe[M] to ArrowAssoc[TestProbe[M]]

Ungrouped