Class/Object

akka.testkit.javadsl

TestKit

Related Docs: object TestKit | package javadsl

Permalink

class TestKit extends AnyRef

Java API: Test kit for testing actors. Inheriting from this class enables reception of replies from actors, which are queued by an internal actor and can be examined using the expectMsg... methods. Assertions and bounds concerning timing are available in the form of Within blocks.

Beware of two points:

Source
TestKit.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TestKit
  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 TestKit(system: ActorSystem)

    Permalink

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 TestKit to any2stringadd[TestKit] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (TestKit, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestKit to ArrowAssoc[TestKit] 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](max: Duration, interval: Duration, a: Supplier[A]): A

    Permalink

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

    Evaluate the given assert every interval until it does not throw an exception. 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".

    returns

    an arbitrary value that would be returned from awaitAssert if successful, if not interested in such value you can return null.

  8. def awaitAssert[A](max: Duration, a: 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.

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

  9. def awaitAssert[A](a: 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.

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

  10. def awaitCond(max: Duration, interval: Duration, message: String, p: Supplier[Boolean]): Unit

    Permalink

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

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

  11. def awaitCond(max: Duration, interval: Duration, p: Supplier[Boolean]): Unit

    Permalink

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

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

  12. def awaitCond(max: Duration, p: Supplier[Boolean]): Unit

    Permalink

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

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

  13. def awaitCond(p: Supplier[Boolean]): Unit

    Permalink

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

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

  14. def childActorOf(props: Props): ActorRef

    Permalink

    Spawns an actor as a child of this test actor with an auto-generated name and stopping supervisor strategy, returning the child's ActorRef.

  15. def childActorOf(props: Props, name: String): ActorRef

    Permalink

    Spawns an actor as a child of this test actor with a stopping supervisor strategy, and returns the child's ActorRef.

  16. def childActorOf(props: Props, supervisorStrategy: SupervisorStrategy): ActorRef

    Permalink

    Spawns an actor as a child of this test actor with an auto-generated name, and returns the child's ActorRef.

  17. def childActorOf(props: Props, name: String, supervisorStrategy: SupervisorStrategy): ActorRef

    Permalink

    Spawns an actor as a child of this test actor, and returns the child's ActorRef.

  18. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. def dilated(duration: Duration): Duration

    Permalink

    Java timeouts (durations) during tests with the configured

  20. def duration(s: String): FiniteDuration

    Permalink
  21. def ensuring(cond: (TestKit) ⇒ Boolean, msg: ⇒ Any): TestKit

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  27. def expectMsg[T](max: Duration, obj: T, hint: String): 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 AssertionFailure being thrown in case of timeout.

  28. def expectMsg[T](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 AssertionFailure being thrown in case of timeout.

  29. def expectMsg[T](obj: T): T

    Permalink

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

  30. def expectMsgAllOf[T](max: Duration, objs: T*): List[T]

    Permalink

    Receive a number of messages from the test actor matching the given number of objects and assert that for each given object one is received which equals it and vice versa.

    Receive a number of messages from the test actor matching the given number of objects and assert that for each given object one is received which equals it and vice versa. This construct is useful when the order in which the objects are received is not fixed. Wait time is bounded by the given duration, with an AssertionFailure being thrown in case of timeout.

  31. def expectMsgAllOf[T](objs: T*): List[T]

    Permalink

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

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

    Annotations
    @varargs()
  32. def expectMsgAnyClassOf[T](max: Duration, objs: Class[_]*): T

    Permalink

    Receive one message from the test actor and assert that it conforms to one of the given classes.

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

    Annotations
    @varargs()
  33. def expectMsgAnyClassOf[T](objs: Class[_]*): T

    Permalink

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

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

    Annotations
    @varargs()
  34. def expectMsgAnyOf[T](max: Duration, objs: T*): T

    Permalink

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

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

  35. def expectMsgAnyOf[T](objs: T*): T

    Permalink

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

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

    Annotations
    @varargs()
  36. def expectMsgClass[T](max: Duration, c: Class[T]): T

    Permalink

    Receive one message from the test actor and assert that it conforms to the given class.

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

  37. def expectMsgClass[T](c: Class[T]): T

    Permalink

    Same as expectMsgClass(remainingOrDefault, c), but correctly treating the timeFactor.

  38. def expectMsgEquals[T](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 AssertionFailure being thrown in case of timeout.

    returns

    the received object

  39. def expectMsgEquals[T](obj: T): T

    Permalink

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

  40. def expectMsgPF[T](max: Duration, hint: String, f: Function[Any, T]): T

    Permalink

    Receive one message from the test actor and assert that the given partial function accepts it.

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

    Use this variant to implement more complicated or conditional processing.

  41. def expectMsgPF[T](max: Duration, hint: String, f: Function[Any, T]): T

    Permalink

    Receive one message from the test actor and assert that the given partial function accepts it.

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

    Use this variant to implement more complicated or conditional processing.

  42. def expectMsgPF[T](hint: String, f: Function[Any, T]): T

    Permalink

    Receive one message from the test actor and assert that the given partial function accepts it.

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

    Use this variant to implement more complicated or conditional processing.

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

  44. def expectNoMessage(): Unit

    Permalink

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

  45. def expectTerminated(target: ActorRef): Terminated

    Permalink

    Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef.

    Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef. Before calling this method, you have to watch the target actor ref. Wait time is bounded by the given duration, with an AssertionFailure being thrown in case of timeout.

    target

    the actor ref expected to be Terminated

    returns

    the received Terminated message

  46. def expectTerminated(max: Duration, target: ActorRef): Terminated

    Permalink

    Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef.

    Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef. Before calling this method, you have to watch the target actor ref. Wait time is bounded by the given duration, with an AssertionFailure being thrown in case of timeout.

    max

    wait no more than max time, otherwise throw AssertionFailure

    target

    the actor ref expected to be Terminated

    returns

    the received Terminated message

  47. def expectTerminated(max: Duration, target: ActorRef): Terminated

    Permalink

    Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef.

    Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef. Before calling this method, you have to watch the target actor ref. Wait time is bounded by the given duration, with an AssertionFailure being thrown in case of timeout.

    max

    wait no more than max time, otherwise throw AssertionFailure

    target

    the actor ref expected to be Terminated

    returns

    the received Terminated message

  48. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  49. def fishForMessage(max: Duration, hint: String, f: Function[Any, Boolean]): Any

    Permalink

    Hybrid of expectMsgPF and receiveWhile: receive messages while the partial function matches and returns false.

    Hybrid of expectMsgPF and receiveWhile: receive messages while the partial function matches and returns false. Use it to ignore certain messages while waiting for a specific message.

    returns

    the last received message, i.e. the first one for which the partial function returned true

  50. def fishForSpecificMessage[T](max: Duration, hint: String, f: Function[Any, T]): T

    Permalink

    Same as fishForMessage, but gets a different partial function and returns properly typed message.

  51. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from TestKit to StringFormat[TestKit] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  52. def forward(actor: ActorRef): Unit

    Permalink

    Forward this message as if in the TestActor's receive method with self.forward.

  53. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  54. def getLastSender: ActorRef

    Permalink

    Get the last sender of the TestProbe

  55. def getRef: ActorRef

    Permalink

    Shorthand to get the testActor.

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

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

  58. 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.test.single-expect-default").

  59. def getSystem: ActorSystem

    Permalink
  60. def getTestActor: ActorRef

    Permalink

    ActorRef of the test actor.

    ActorRef of the test actor. Access is provided to enable e.g. registration as message target.

  61. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  62. def ignoreMsg(pf: Function[Any, Boolean]): Unit

    Permalink

    Ignore all messages in the test actor for which the given partial function returns true.

  63. def ignoreNoMsg(): Unit

    Permalink

    Stop ignoring messages in the test actor.

  64. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  65. def msgAvailable: Boolean

    Permalink

    Query queue status.

  66. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  69. def receiveN(n: Int, max: Duration): List[AnyRef]

    Permalink

    Receive N messages in a row before the given deadline.

  70. def receiveN(n: Int): List[AnyRef]

    Permalink

    Same as receiveN(n, remaining) but correctly taking into account Duration.timeFactor.

  71. def receiveOne(max: Duration): AnyRef

    Permalink

    Receive one message from the internal queue of the TestActor.

    Receive one message from the internal queue of the TestActor. If the given duration is zero, the queue is polled (non-blocking).

    This method does NOT automatically scale its Duration parameter!

  72. def receiveWhile[T](max: Duration, f: Function[AnyRef, T]): List[T]

    Permalink
  73. def receiveWhile[T](max: Duration, idle: Duration, messages: Int, f: Function[AnyRef, T]): List[T]

    Permalink

    Receive a series of messages until one does not match the given partial function or the idle timeout is met (disabled by default) or the overall maximum duration is elapsed or expected messages count is reached.

    Receive a series of messages until one does not match the given partial function or the idle timeout is met (disabled by default) or the overall maximum duration is elapsed or expected messages count is reached. Returns the sequence of messages.

    Note that it is not an error to hit the max duration in this case.

    One possible use of this method is for testing whether messages of certain characteristics are generated at a certain rate:

  74. def reply(msg: AnyRef): Unit

    Permalink

    Send message to the sender of the last dequeued message.

  75. def send(actor: ActorRef, msg: AnyRef): Unit

    Permalink

    Send message to an actor while using the probe's TestActor as the sender.

    Send message to an actor while using the probe's TestActor as the sender. Replies will be available for inspection with all of TestKit's assertion methods.

  76. def setAutoPilot(pilot: AutoPilot): Unit

    Permalink

    Install an AutoPilot to drive the testActor: the AutoPilot will be run for each received message and can be used to send or forward messages, etc.

    Install an AutoPilot to drive the testActor: the AutoPilot will be run for each received message and can be used to send or forward messages, etc. Each invocation must return the AutoPilot for the next round.

  77. final def synchronized[T0](arg0: ⇒ T0): T0

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

    Permalink
    Definition Classes
    AnyRef → Any
  79. def unwatch(ref: ActorRef): ActorRef

    Permalink

    Have the testActor stop watching someone (i.e.

    Have the testActor stop watching someone (i.e. context.unwatch(...)).

  80. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  83. def watch(ref: ActorRef): ActorRef

    Permalink

    Have the testActor watch someone (i.e.

    Have the testActor watch someone (i.e. context.watch(...)).

  84. def within[T](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.test.timefactor", while the min Duration is not.

    within(java.time.Duration.ofMillis(50), () -> {
      test.tell("ping");
      return expectMsgClass(String.class);
    });
  85. 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.test.timefactor", while the min Duration is not.

    within(java.time.Duration.ofMillis(50), () -> {
      test.tell("ping");
      return expectMsgClass(String.class);
    });
  86. def [B](y: B): (TestKit, B)

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

Deprecated Value Members

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

    Permalink

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

    Evaluate the given assert every interval until it does not throw an exception. 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".

    returns

    an arbitrary value that would be returned from awaitAssert if successful, if not interested in such value you can return null.

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.13) Use the overloaded one which accepts java.time.Duration instead.

  2. def awaitAssert[A](max: Duration, a: 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.

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

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.13) Use the overloaded one which accepts java.time.Duration instead.

  3. def awaitCond(max: Duration, interval: Duration, message: String, p: Supplier[Boolean]): Unit

    Permalink

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

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

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

  4. def awaitCond(max: Duration, interval: Duration, p: Supplier[Boolean]): Unit

    Permalink

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

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

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

  5. def awaitCond(max: Duration, p: Supplier[Boolean]): Unit

    Permalink

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

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

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

  6. def dilated(d: FiniteDuration): FiniteDuration

    Permalink

    Scale timeouts (durations) during tests with the configured

    Scale timeouts (durations) during tests with the configured

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

  7. def expectMsg[T](max: FiniteDuration, obj: T, hint: String): 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 AssertionFailure being thrown in case of timeout.

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

  8. def expectMsg[T](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 AssertionFailure being thrown in case of timeout.

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

  9. def expectMsgAllOf[T](max: FiniteDuration, objs: T*): List[T]

    Permalink

    Receive a number of messages from the test actor matching the given number of objects and assert that for each given object one is received which equals it and vice versa.

    Receive a number of messages from the test actor matching the given number of objects and assert that for each given object one is received which equals it and vice versa. This construct is useful when the order in which the objects are received is not fixed. Wait time is bounded by the given duration, with an AssertionFailure being thrown in case of timeout.

    Annotations
    @varargs() @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

  10. def expectMsgAnyClassOf[T](max: FiniteDuration, objs: Class[_]*): T

    Permalink

    Receive one message from the test actor and assert that it conforms to one of the given classes.

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

    Annotations
    @varargs() @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

  11. def expectMsgAnyOf[T](max: FiniteDuration, objs: T*): T

    Permalink

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

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

    Annotations
    @varargs() @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

  12. def expectMsgClass[T](max: FiniteDuration, c: Class[T]): T

    Permalink

    Receive one message from the test actor and assert that it conforms to the given class.

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

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

  13. def expectMsgEquals[T](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 AssertionFailure being thrown in case of timeout.

    returns

    the received object

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

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

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

  15. def expectNoMsg(max: FiniteDuration): Unit

    Permalink

    Assert that no message is received for the specified time.

    Assert that no message is received for the specified time.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.5.10) Use expectNoMessage instead

  16. def expectNoMsg(): Unit

    Permalink

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

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

    Annotations
    @deprecated
    Deprecated

    (Since version 2.5.10) Use expectNoMessage instead

  17. def receiveN(n: Int, max: FiniteDuration): List[AnyRef]

    Permalink

    Receive N messages in a row before the given deadline.

    Receive N messages in a row before the given deadline.

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

  18. def receiveOne(max: Duration): AnyRef

    Permalink

    Receive one message from the internal queue of the TestActor.

    Receive one message from the internal queue of the TestActor. If the given duration is zero, the queue is polled (non-blocking).

    This method does NOT automatically scale its Duration parameter!

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.13) Use the overloaded one which accepts java.time.Duration instead.

  19. def receiveWhile[T](max: Duration, f: Function[AnyRef, T]): List[T]

    Permalink
    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.13) Use the overloaded one which accepts java.time.Duration instead.

  20. def receiveWhile[T](max: Duration, idle: Duration, messages: Int, f: Function[AnyRef, T]): List[T]

    Permalink

    Receive a series of messages until one does not match the given partial function or the idle timeout is met (disabled by default) or the overall maximum duration is elapsed or expected messages count is reached.

    Receive a series of messages until one does not match the given partial function or the idle timeout is met (disabled by default) or the overall maximum duration is elapsed or expected messages count is reached. Returns the sequence of messages.

    Note that it is not an error to hit the max duration in this case.

    One possible use of this method is for testing whether messages of certain characteristics are generated at a certain rate:

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.13) Use the overloaded one which accepts java.time.Duration instead.

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

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

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use getRemaining which returns java.time.Duration instead.

  22. def remainingOr(fd: FiniteDuration): FiniteDuration

    Permalink

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

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

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use getRemainingOr which returns java.time.Duration instead.

  23. 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.test.single-expect-default").

    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.test.single-expect-default").

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use getRemainingOrDefault which returns java.time.Duration instead.

  24. def within[T](max: FiniteDuration, 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.test.timefactor", while the min Duration is not.

    within(duration("50 millis"), () -> {
      test.tell("ping");
      return expectMsgClass(String.class);
    });
    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

  25. def within[T](min: FiniteDuration, max: FiniteDuration, 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.test.timefactor", while the min Duration is not.

    within(duration("50 millis"), () -> {
      test.tell("ping");
      return expectMsgClass(String.class);
    });
    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.12) Use the overloaded one which accepts java.time.Duration instead.

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from TestKit to any2stringadd[TestKit]

Inherited by implicit conversion StringFormat from TestKit to StringFormat[TestKit]

Inherited by implicit conversion Ensuring from TestKit to Ensuring[TestKit]

Inherited by implicit conversion ArrowAssoc from TestKit to ArrowAssoc[TestKit]

Ungrouped