Trait/Object

akka.actor.testkit.typed.scaladsl

TestProbe

Related Docs: object TestProbe | package scaladsl

Permalink

trait TestProbe[M] extends AnyRef

Create instances through the factories in the TestProbe companion.

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

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

Abstract Value Members

  1. abstract def awaitAssert[A](a: ⇒ A, max: Duration = Duration.Undefined, interval: Duration = 100.millis): 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.

    If no timeout is given, take it from the innermost enclosing within block.

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

  2. abstract def expectMessage[T <: M](max: FiniteDuration, 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: FiniteDuration, 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
    Attributes
    protected
  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: FiniteDuration): 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: FiniteDuration): Unit

    Permalink

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

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

    Permalink
    Attributes
    protected
  10. abstract def ref: typed.ActorRef[M]

    Permalink

    ActorRef for this TestProbe

  11. abstract def remaining: FiniteDuration

    Permalink

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

  12. abstract def remainingOr(duration: FiniteDuration): FiniteDuration

    Permalink

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

  13. abstract def remainingOrDefault: FiniteDuration

    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").

  14. implicit abstract def settings: TestKitSettings

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

    Permalink
    Attributes
    protected

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 clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. 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
  9. 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
  10. 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
  11. 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
  12. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  14. def expectMessageType[T <: M](max: FiniteDuration)(implicit t: ClassTag[T]): T

    Permalink

    Expect a message of type T to arrive within max or fail.

    Expect a message of type T to arrive within max or fail. max is dilated.

  15. def expectMessageType[T <: M](implicit t: ClassTag[T]): T

    Permalink

    Same as expectMessageType[T](remainingOrDefault), but correctly treating the timeFactor.

  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def fishForMessage(max: FiniteDuration)(fisher: (M) ⇒ FishingOutcome): Seq[M]

    Permalink

    Same as the other fishForMessage but with no hint

  18. def fishForMessage(max: FiniteDuration, hint: String)(fisher: (M) ⇒ FishingOutcome): Seq[M]

    Permalink

    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:

    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.continueAndIgnore - continue and do not save the message in the returned list * FishingOutcomes.complete - successfully complete and return the message * FishingOutcomes.fail - 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

  19. 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()
  20. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  21. def hashCode(): Int

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

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

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. def within[T](max: FiniteDuration)(f: ⇒ T): T

    Permalink

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

  32. def within[T](min: FiniteDuration, max: FiniteDuration)(f: ⇒ 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]
    }
  33. 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