Class TestKit


  • public class TestKit
    extends java.lang.Object
    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:

    - the ActorSystem passed into the constructor needs to be shutdown, otherwise thread pools and memory will be leaked - this trait is not thread-safe (only one actor with one queue, one stack of Within blocks); take care not to run tests within a single test class instance in parallel.

    - It should be noted that for CI servers and the like all maximum Durations are scaled using the dilated method, which uses the TestKitExtension.Settings.TestTimeFactor settable via akka.conf entry "akka.test.timefactor".

    • Constructor Summary

      Constructors 
      Constructor Description
      TestKit​(ActorSystem system)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      <A> A awaitAssert​(java.time.Duration max, java.time.Duration interval, java.util.function.Supplier<A> a)
      Evaluate the given assert every interval until it does not throw an exception.
      <A> A awaitAssert​(java.time.Duration max, java.util.function.Supplier<A> a)
      Evaluate the given assert every interval until it does not throw an exception and return the result.
      <A> A awaitAssert​(java.util.function.Supplier<A> a)
      Evaluate the given assert every interval until it does not throw an exception and return the result.
      <A> A awaitAssert​(scala.concurrent.duration.Duration max, java.util.function.Supplier<A> a)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      <A> A awaitAssert​(scala.concurrent.duration.Duration max, scala.concurrent.duration.Duration interval, java.util.function.Supplier<A> a)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      void awaitCond​(java.time.Duration max, java.time.Duration interval, java.lang.String message, java.util.function.Supplier<java.lang.Object> p)
      Await until the given condition evaluates to true or the timeout expires, whichever comes first.
      void awaitCond​(java.time.Duration max, java.time.Duration interval, java.util.function.Supplier<java.lang.Object> p)
      Await until the given condition evaluates to true or the timeout expires, whichever comes first.
      void awaitCond​(java.time.Duration max, java.util.function.Supplier<java.lang.Object> p)
      Await until the given condition evaluates to true or the timeout expires, whichever comes first.
      void awaitCond​(java.util.function.Supplier<java.lang.Object> p)
      Await until the given condition evaluates to true or the timeout expires, whichever comes first.
      void awaitCond​(scala.concurrent.duration.Duration max, java.util.function.Supplier<java.lang.Object> p)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      void awaitCond​(scala.concurrent.duration.Duration max, scala.concurrent.duration.Duration interval, java.lang.String message, java.util.function.Supplier<java.lang.Object> p)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      void awaitCond​(scala.concurrent.duration.Duration max, scala.concurrent.duration.Duration interval, java.util.function.Supplier<java.lang.Object> p)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      ActorRef childActorOf​(Props props)
      Spawns an actor as a child of this test actor with an auto-generated name and stopping supervisor strategy, returning the child's ActorRef.
      ActorRef childActorOf​(Props props, SupervisorStrategy supervisorStrategy)
      Spawns an actor as a child of this test actor with an auto-generated name, and returns the child's ActorRef.
      ActorRef childActorOf​(Props props, java.lang.String name)
      Spawns an actor as a child of this test actor with a stopping supervisor strategy, and returns the child's ActorRef.
      ActorRef childActorOf​(Props props, java.lang.String name, SupervisorStrategy supervisorStrategy)
      Spawns an actor as a child of this test actor, and returns the child's ActorRef.
      java.time.Duration dilated​(java.time.Duration duration)
      Java timeouts (durations) during tests with the configured
      scala.concurrent.duration.FiniteDuration dilated​(scala.concurrent.duration.FiniteDuration d)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      scala.concurrent.duration.FiniteDuration duration​(java.lang.String s)  
      <T> T expectMsg​(java.time.Duration max, T obj)
      Receive one message from the test actor and assert that it equals the given object.
      <T> T expectMsg​(java.time.Duration max, T obj, java.lang.String hint)
      Receive one message from the test actor and assert that it equals the given object.
      <T> T expectMsg​(scala.concurrent.duration.FiniteDuration max, T obj)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      <T> T expectMsg​(scala.concurrent.duration.FiniteDuration max, T obj, java.lang.String hint)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      <T> T expectMsg​(T obj)
      Same as expectMsg(remainingOrDefault, obj), but correctly treating the timeFactor.
      <T> java.util.List<T> expectMsgAllOf​(java.lang.Object... objs)
      Same as expectMsgAllOf(remainingOrDefault, obj...), but correctly treating the timeFactor.
      <T> java.util.List<T> expectMsgAllOf​(java.time.Duration max, scala.collection.Seq<T> objs)
      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.
      <T> java.util.List<T> expectMsgAllOf​(scala.collection.Seq<T> objs)
      Same as expectMsgAllOf(remainingOrDefault, obj...), but correctly treating the timeFactor.
      <T> java.util.List<T> expectMsgAllOf​(scala.concurrent.duration.FiniteDuration max, java.lang.Object... objs)
      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.
      <T> java.util.List<T> expectMsgAllOf​(scala.concurrent.duration.FiniteDuration max, scala.collection.Seq<T> objs)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      <T> T expectMsgAnyClassOf​(java.lang.Class<?>... objs)
      Same as expectMsgAnyClassOf(remainingOrDefault, obj...), but correctly treating the timeFactor.
      <T> T expectMsgAnyClassOf​(java.time.Duration max, java.lang.Class<?>... objs)
      Receive one message from the test actor and assert that it conforms to one of the given classes.
      <T> T expectMsgAnyClassOf​(java.time.Duration max, scala.collection.Seq<java.lang.Class<?>> objs)
      Receive one message from the test actor and assert that it conforms to one of the given classes.
      <T> T expectMsgAnyClassOf​(scala.collection.Seq<java.lang.Class<?>> objs)
      Same as expectMsgAnyClassOf(remainingOrDefault, obj...), but correctly treating the timeFactor.
      <T> T expectMsgAnyClassOf​(scala.concurrent.duration.FiniteDuration max, java.lang.Class<?>... objs)
      Receive one message from the test actor and assert that it conforms to one of the given classes.
      <T> T expectMsgAnyClassOf​(scala.concurrent.duration.FiniteDuration max, scala.collection.Seq<java.lang.Class<?>> objs)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      <T> T expectMsgAnyOf​(java.lang.Object... objs)
      Same as expectMsgAnyOf(remainingOrDefault, obj...), but correctly treating the timeFactor.
      <T> T expectMsgAnyOf​(java.time.Duration max, scala.collection.Seq<T> objs)
      Receive one message from the test actor and assert that it equals one of the given objects.
      <T> T expectMsgAnyOf​(scala.collection.Seq<T> objs)
      Same as expectMsgAnyOf(remainingOrDefault, obj...), but correctly treating the timeFactor.
      <T> T expectMsgAnyOf​(scala.concurrent.duration.FiniteDuration max, java.lang.Object... objs)
      Receive one message from the test actor and assert that it equals one of the given objects.
      <T> T expectMsgAnyOf​(scala.concurrent.duration.FiniteDuration max, scala.collection.Seq<T> objs)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      <T> T expectMsgClass​(java.lang.Class<T> c)
      Same as expectMsgClass(remainingOrDefault, c), but correctly treating the timeFactor.
      <T> T expectMsgClass​(java.time.Duration max, java.lang.Class<T> c)
      Receive one message from the test actor and assert that it conforms to the given class.
      <T> T expectMsgClass​(scala.concurrent.duration.FiniteDuration max, java.lang.Class<T> c)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      <T> T expectMsgEquals​(java.time.Duration max, T obj)
      Receive one message from the test actor and assert that it equals the given object.
      <T> T expectMsgEquals​(scala.concurrent.duration.FiniteDuration max, T obj)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      <T> T expectMsgEquals​(T obj)
      Same as expectMsg(remainingOrDefault, obj), but correctly treating the timeFactor.
      <T> T expectMsgPF​(java.lang.String hint, java.util.function.Function<java.lang.Object,​T> f)
      Receive one message from the test actor and assert that the given partial function accepts it.
      <T> T expectMsgPF​(java.time.Duration max, java.lang.String hint, java.util.function.Function<java.lang.Object,​T> f)
      Receive one message from the test actor and assert that the given partial function accepts it.
      <T> T expectMsgPF​(scala.concurrent.duration.Duration max, java.lang.String hint, java.util.function.Function<java.lang.Object,​T> f)
      Receive one message from the test actor and assert that the given partial function accepts it.
      void expectNoMessage()
      Same as expectNoMessage(remainingOrDefault), but correctly treating the timeFactor.
      void expectNoMessage​(java.time.Duration max)
      Assert that no message is received for the specified time.
      void expectNoMessage​(scala.concurrent.duration.FiniteDuration max)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      void expectNoMsg()
      Deprecated.
      Use expectNoMessage instead.
      void expectNoMsg​(scala.concurrent.duration.FiniteDuration max)
      Deprecated.
      Use expectNoMessage instead.
      Terminated expectTerminated​(ActorRef target)
      Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef.
      Terminated expectTerminated​(java.time.Duration max, ActorRef target)
      Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef.
      Terminated expectTerminated​(scala.concurrent.duration.Duration max, ActorRef target)
      Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef.
      java.lang.Object fishForMessage​(scala.concurrent.duration.Duration max, java.lang.String hint, java.util.function.Function<java.lang.Object,​java.lang.Object> f)
      Hybrid of expectMsgPF and receiveWhile: receive messages while the partial function matches and returns false.
      <T> T fishForSpecificMessage​(scala.concurrent.duration.Duration max, java.lang.String hint, java.util.function.Function<java.lang.Object,​T> f)
      Same as fishForMessage, but gets a different partial function and returns properly typed message.
      void forward​(ActorRef actor)
      Forward this message as if in the TestActor's receive method with self.forward.
      ActorRef getLastSender()
      Get the last sender of the TestProbe
      ActorRef getRef()
      Shorthand to get the testActor.
      java.time.Duration getRemaining()
      Obtain time remaining for execution of the innermost enclosing within block or throw an AssertionError if no within block surrounds this call.
      java.time.Duration getRemainingOr​(java.time.Duration duration)
      Obtain time remaining for execution of the innermost enclosing within block or missing that it returns the given duration.
      java.time.Duration getRemainingOrDefault()
      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").
      ActorSystem getSystem()  
      ActorRef getTestActor()
      ActorRef of the test actor.
      void ignoreMsg​(java.util.function.Function<java.lang.Object,​java.lang.Object> pf)
      Ignore all messages in the test actor for which the given partial function returns true.
      void ignoreNoMsg()
      Stop ignoring messages in the test actor.
      boolean msgAvailable()
      Query queue status.
      java.util.List<java.lang.Object> receiveN​(int n)
      Same as receiveN(n, remaining) but correctly taking into account Duration.timeFactor.
      java.util.List<java.lang.Object> receiveN​(int n, java.time.Duration max)
      Receive N messages in a row before the given deadline.
      java.util.List<java.lang.Object> receiveN​(int n, scala.concurrent.duration.FiniteDuration max)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      java.lang.Object receiveOne​(java.time.Duration max)
      Receive one message from the internal queue of the TestActor.
      java.lang.Object receiveOne​(scala.concurrent.duration.Duration max)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      <T> java.util.List<T> receiveWhile​(java.time.Duration max, java.time.Duration idle, int messages, java.util.function.Function<java.lang.Object,​T> f)
      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.
      <T> java.util.List<T> receiveWhile​(java.time.Duration max, java.util.function.Function<java.lang.Object,​T> f)  
      <T> java.util.List<T> receiveWhile​(scala.concurrent.duration.Duration max, java.util.function.Function<java.lang.Object,​T> f)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      <T> java.util.List<T> receiveWhile​(scala.concurrent.duration.Duration max, scala.concurrent.duration.Duration idle, int messages, java.util.function.Function<java.lang.Object,​T> f)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      scala.concurrent.duration.FiniteDuration remaining()
      Deprecated.
      Use getRemaining which returns java.time.Duration instead.
      scala.concurrent.duration.FiniteDuration remainingOr​(scala.concurrent.duration.FiniteDuration fd)
      Deprecated.
      Use getRemainingOr which returns java.time.Duration instead.
      scala.concurrent.duration.FiniteDuration remainingOrDefault()
      Deprecated.
      Use getRemainingOrDefault which returns java.time.Duration instead.
      void reply​(java.lang.Object msg)
      Send message to the sender of the last dequeued message.
      void send​(ActorRef actor, java.lang.Object msg)
      Send message to an actor while using the probe's TestActor as the sender.
      void setAutoPilot​(TestActor.AutoPilot pilot)
      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.
      static void shutdownActorSystem​(ActorSystem actorSystem)
      Shut down an actor system and wait for termination.
      static void shutdownActorSystem​(ActorSystem actorSystem, boolean verifySystemShutdown)
      Shut down an actor system and wait for termination.
      static void shutdownActorSystem​(ActorSystem actorSystem, scala.concurrent.duration.Duration duration)
      Shut down an actor system and wait for termination.
      static void shutdownActorSystem​(ActorSystem actorSystem, scala.concurrent.duration.Duration duration, boolean verifySystemShutdown)
      Shut down an actor system and wait for termination.
      ActorRef unwatch​(ActorRef ref)
      Have the testActor stop watching someone (i.e.
      ActorRef watch​(ActorRef ref)
      Have the testActor watch someone (i.e.
      <T> T within​(java.time.Duration min, java.time.Duration max, java.util.function.Supplier<T> f)
      Execute code block while bounding its execution time between min and max.
      <T> T within​(java.time.Duration max, java.util.function.Supplier<T> f)
      Execute code block while bounding its execution time between min and max.
      <T> T within​(scala.concurrent.duration.FiniteDuration max, java.util.function.Supplier<T> f)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      <T> T within​(scala.concurrent.duration.FiniteDuration min, scala.concurrent.duration.FiniteDuration max, java.util.function.Supplier<T> f)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • shutdownActorSystem

        public static void shutdownActorSystem​(ActorSystem actorSystem,
                                               scala.concurrent.duration.Duration duration,
                                               boolean verifySystemShutdown)
        Shut down an actor system and wait for termination. On failure debug output will be logged about the remaining actors in the system.

        If verifySystemShutdown is true, then an exception will be thrown on failure.

        Parameters:
        actorSystem - (undocumented)
        duration - (undocumented)
        verifySystemShutdown - (undocumented)
      • shutdownActorSystem

        public static void shutdownActorSystem​(ActorSystem actorSystem)
        Shut down an actor system and wait for termination. On failure debug output will be logged about the remaining actors in the system.
        Parameters:
        actorSystem - (undocumented)
      • shutdownActorSystem

        public static void shutdownActorSystem​(ActorSystem actorSystem,
                                               scala.concurrent.duration.Duration duration)
        Shut down an actor system and wait for termination. On failure debug output will be logged about the remaining actors in the system.
        Parameters:
        actorSystem - (undocumented)
        duration - (undocumented)
      • shutdownActorSystem

        public static void shutdownActorSystem​(ActorSystem actorSystem,
                                               boolean verifySystemShutdown)
        Shut down an actor system and wait for termination. On failure debug output will be logged about the remaining actors in the system.

        If verifySystemShutdown is true, then an exception will be thrown on failure.

        Parameters:
        actorSystem - (undocumented)
        verifySystemShutdown - (undocumented)
      • expectMsgAnyOf

        public <T> T expectMsgAnyOf​(java.lang.Object... objs)
        Same as expectMsgAnyOf(remainingOrDefault, obj...), but correctly treating the timeFactor.
        Parameters:
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAnyOf

        public <T> T expectMsgAnyOf​(scala.concurrent.duration.FiniteDuration max,
                                    java.lang.Object... objs)
        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.
        Parameters:
        max - (undocumented)
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAllOf

        public <T> java.util.List<T> expectMsgAllOf​(java.lang.Object... objs)
        Same as expectMsgAllOf(remainingOrDefault, obj...), but correctly treating the timeFactor.
        Parameters:
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAllOf

        public <T> java.util.List<T> expectMsgAllOf​(scala.concurrent.duration.FiniteDuration max,
                                                    java.lang.Object... objs)
        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.
        Parameters:
        max - (undocumented)
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAnyClassOf

        public <T> T expectMsgAnyClassOf​(java.lang.Class<?>... objs)
        Same as expectMsgAnyClassOf(remainingOrDefault, obj...), but correctly treating the timeFactor.
        Parameters:
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAnyClassOf

        public <T> T expectMsgAnyClassOf​(scala.concurrent.duration.FiniteDuration max,
                                         java.lang.Class<?>... objs)
        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.
        Parameters:
        max - (undocumented)
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAnyClassOf

        public <T> T expectMsgAnyClassOf​(java.time.Duration max,
                                         java.lang.Class<?>... objs)
        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.
        Parameters:
        max - (undocumented)
        objs - (undocumented)
        Returns:
        (undocumented)
      • getTestActor

        public ActorRef getTestActor()
        ActorRef of the test actor. Access is provided to enable e.g. registration as message target.
        Returns:
        (undocumented)
      • getRef

        public ActorRef getRef()
        Shorthand to get the testActor.
        Returns:
        (undocumented)
      • duration

        public scala.concurrent.duration.FiniteDuration duration​(java.lang.String s)
      • dilated

        public scala.concurrent.duration.FiniteDuration dilated​(scala.concurrent.duration.FiniteDuration d)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        Scale timeouts (durations) during tests with the configured
        Parameters:
        d - (undocumented)
        Returns:
        (undocumented)
      • dilated

        public java.time.Duration dilated​(java.time.Duration duration)
        Java timeouts (durations) during tests with the configured
        Parameters:
        duration - (undocumented)
        Returns:
        (undocumented)
      • msgAvailable

        public boolean msgAvailable()
        Query queue status.
        Returns:
        (undocumented)
      • getLastSender

        public ActorRef getLastSender()
        Get the last sender of the TestProbe
        Returns:
        (undocumented)
      • send

        public void send​(ActorRef actor,
                         java.lang.Object msg)
        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.
        Parameters:
        actor - (undocumented)
        msg - (undocumented)
      • forward

        public void forward​(ActorRef actor)
        Forward this message as if in the TestActor's receive method with self.forward.
        Parameters:
        actor - (undocumented)
      • reply

        public void reply​(java.lang.Object msg)
        Send message to the sender of the last dequeued message.
        Parameters:
        msg - (undocumented)
      • watch

        public ActorRef watch​(ActorRef ref)
        Have the testActor watch someone (i.e. context.watch(...)).
        Parameters:
        ref - (undocumented)
        Returns:
        (undocumented)
      • unwatch

        public ActorRef unwatch​(ActorRef ref)
        Have the testActor stop watching someone (i.e. context.unwatch(...)).
        Parameters:
        ref - (undocumented)
        Returns:
        (undocumented)
      • ignoreMsg

        public void ignoreMsg​(java.util.function.Function<java.lang.Object,​java.lang.Object> pf)
        Ignore all messages in the test actor for which the given partial function returns true.
        Parameters:
        pf - (undocumented)
      • ignoreNoMsg

        public void ignoreNoMsg()
        Stop ignoring messages in the test actor.
      • setAutoPilot

        public void setAutoPilot​(TestActor.AutoPilot pilot)
        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.
        Parameters:
        pilot - (undocumented)
      • remaining

        public scala.concurrent.duration.FiniteDuration remaining()
        Deprecated.
        Use getRemaining which returns java.time.Duration instead. Since 2.5.12.
        Obtain time remaining for execution of the innermost enclosing within block or throw an AssertionError if no within block surrounds this call.
        Returns:
        (undocumented)
      • getRemaining

        public java.time.Duration getRemaining()
        Obtain time remaining for execution of the innermost enclosing within block or throw an AssertionError if no within block surrounds this call.
        Returns:
        (undocumented)
      • remainingOr

        public scala.concurrent.duration.FiniteDuration remainingOr​(scala.concurrent.duration.FiniteDuration fd)
        Deprecated.
        Use getRemainingOr which returns java.time.Duration instead. Since 2.5.12.
        Obtain time remaining for execution of the innermost enclosing within block or missing that it returns the given duration.
        Parameters:
        fd - (undocumented)
        Returns:
        (undocumented)
      • getRemainingOr

        public java.time.Duration getRemainingOr​(java.time.Duration duration)
        Obtain time remaining for execution of the innermost enclosing within block or missing that it returns the given duration.
        Parameters:
        duration - (undocumented)
        Returns:
        (undocumented)
      • remainingOrDefault

        public scala.concurrent.duration.FiniteDuration remainingOrDefault()
        Deprecated.
        Use getRemainingOrDefault which returns java.time.Duration instead. Since 2.5.12.
        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").
        Returns:
        (undocumented)
      • getRemainingOrDefault

        public java.time.Duration getRemainingOrDefault()
        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").
        Returns:
        (undocumented)
      • within

        public <T> T within​(scala.concurrent.duration.FiniteDuration min,
                            scala.concurrent.duration.FiniteDuration max,
                            java.util.function.Supplier<T> f)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        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);
          });
        
         
        Parameters:
        min - (undocumented)
        max - (undocumented)
        f - (undocumented)
        Returns:
        (undocumented)
      • within

        public <T> T within​(java.time.Duration min,
                            java.time.Duration max,
                            java.util.function.Supplier<T> f)
        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);
          });
        
         
        Parameters:
        min - (undocumented)
        max - (undocumented)
        f - (undocumented)
        Returns:
        (undocumented)
      • within

        public <T> T within​(scala.concurrent.duration.FiniteDuration max,
                            java.util.function.Supplier<T> f)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        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);
          });
        
         
        Parameters:
        max - (undocumented)
        f - (undocumented)
        Returns:
        (undocumented)
      • within

        public <T> T within​(java.time.Duration max,
                            java.util.function.Supplier<T> f)
        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);
          });
        
         
        Parameters:
        max - (undocumented)
        f - (undocumented)
        Returns:
        (undocumented)
      • awaitCond

        public void awaitCond​(java.util.function.Supplier<java.lang.Object> p)
        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".

        Parameters:
        p - (undocumented)
      • awaitCond

        public void awaitCond​(scala.concurrent.duration.Duration max,
                              java.util.function.Supplier<java.lang.Object> p)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        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".

        Parameters:
        max - (undocumented)
        p - (undocumented)
      • awaitCond

        public void awaitCond​(java.time.Duration max,
                              java.util.function.Supplier<java.lang.Object> p)
        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".

        Parameters:
        max - (undocumented)
        p - (undocumented)
      • awaitCond

        public void awaitCond​(scala.concurrent.duration.Duration max,
                              scala.concurrent.duration.Duration interval,
                              java.util.function.Supplier<java.lang.Object> p)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        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".

        Parameters:
        max - (undocumented)
        interval - (undocumented)
        p - (undocumented)
      • awaitCond

        public void awaitCond​(java.time.Duration max,
                              java.time.Duration interval,
                              java.util.function.Supplier<java.lang.Object> p)
        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".

        Parameters:
        max - (undocumented)
        interval - (undocumented)
        p - (undocumented)
      • awaitCond

        public void awaitCond​(scala.concurrent.duration.Duration max,
                              scala.concurrent.duration.Duration interval,
                              java.lang.String message,
                              java.util.function.Supplier<java.lang.Object> p)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        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".

        Parameters:
        max - (undocumented)
        interval - (undocumented)
        message - (undocumented)
        p - (undocumented)
      • awaitCond

        public void awaitCond​(java.time.Duration max,
                              java.time.Duration interval,
                              java.lang.String message,
                              java.util.function.Supplier<java.lang.Object> p)
        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".

        Parameters:
        max - (undocumented)
        interval - (undocumented)
        message - (undocumented)
        p - (undocumented)
      • awaitAssert

        public <A> A awaitAssert​(java.util.function.Supplier<A> a)
        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".

        Parameters:
        a - (undocumented)
        Returns:
        (undocumented)
      • awaitAssert

        public <A> A awaitAssert​(scala.concurrent.duration.Duration max,
                                 java.util.function.Supplier<A> a)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.13.
        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".

        Parameters:
        max - (undocumented)
        a - (undocumented)
        Returns:
        (undocumented)
      • awaitAssert

        public <A> A awaitAssert​(java.time.Duration max,
                                 java.util.function.Supplier<A> a)
        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".

        Parameters:
        max - (undocumented)
        a - (undocumented)
        Returns:
        (undocumented)
      • awaitAssert

        public <A> A awaitAssert​(scala.concurrent.duration.Duration max,
                                 scala.concurrent.duration.Duration interval,
                                 java.util.function.Supplier<A> a)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.13.
        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".

        Parameters:
        max - (undocumented)
        interval - (undocumented)
        a - (undocumented)
        Returns:
        an arbitrary value that would be returned from awaitAssert if successful, if not interested in such value you can return null.
      • awaitAssert

        public <A> A awaitAssert​(java.time.Duration max,
                                 java.time.Duration interval,
                                 java.util.function.Supplier<A> a)
        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".

        Parameters:
        max - (undocumented)
        interval - (undocumented)
        a - (undocumented)
        Returns:
        an arbitrary value that would be returned from awaitAssert if successful, if not interested in such value you can return null.
      • expectMsgEquals

        public <T> T expectMsgEquals​(T obj)
        Same as expectMsg(remainingOrDefault, obj), but correctly treating the timeFactor.
        Parameters:
        obj - (undocumented)
        Returns:
        (undocumented)
      • expectMsgEquals

        public <T> T expectMsgEquals​(scala.concurrent.duration.FiniteDuration max,
                                     T obj)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        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.

        Parameters:
        max - (undocumented)
        obj - (undocumented)
        Returns:
        the received object
      • expectMsgEquals

        public <T> T expectMsgEquals​(java.time.Duration max,
                                     T obj)
        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.

        Parameters:
        max - (undocumented)
        obj - (undocumented)
        Returns:
        the received object
      • expectMsg

        public <T> T expectMsg​(T obj)
        Same as expectMsg(remainingOrDefault, obj), but correctly treating the timeFactor.
        Parameters:
        obj - (undocumented)
        Returns:
        (undocumented)
      • expectMsg

        public <T> T expectMsg​(scala.concurrent.duration.FiniteDuration max,
                               T obj)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        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.
        Parameters:
        max - (undocumented)
        obj - (undocumented)
        Returns:
        (undocumented)
      • expectMsg

        public <T> T expectMsg​(java.time.Duration max,
                               T obj)
        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.
        Parameters:
        max - (undocumented)
        obj - (undocumented)
        Returns:
        (undocumented)
      • expectMsg

        public <T> T expectMsg​(scala.concurrent.duration.FiniteDuration max,
                               T obj,
                               java.lang.String hint)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        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.
        Parameters:
        max - (undocumented)
        obj - (undocumented)
        hint - (undocumented)
        Returns:
        (undocumented)
      • expectMsg

        public <T> T expectMsg​(java.time.Duration max,
                               T obj,
                               java.lang.String hint)
        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.
        Parameters:
        max - (undocumented)
        obj - (undocumented)
        hint - (undocumented)
        Returns:
        (undocumented)
      • expectMsgPF

        public <T> T expectMsgPF​(java.lang.String hint,
                                 java.util.function.Function<java.lang.Object,​T> f)
        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.

        Parameters:
        hint - (undocumented)
        f - (undocumented)
        Returns:
        (undocumented)
      • expectMsgPF

        public <T> T expectMsgPF​(scala.concurrent.duration.Duration max,
                                 java.lang.String hint,
                                 java.util.function.Function<java.lang.Object,​T> f)
        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.

        Parameters:
        max - (undocumented)
        hint - (undocumented)
        f - (undocumented)
        Returns:
        (undocumented)
      • expectMsgPF

        public <T> T expectMsgPF​(java.time.Duration max,
                                 java.lang.String hint,
                                 java.util.function.Function<java.lang.Object,​T> f)
        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.

        Parameters:
        max - (undocumented)
        hint - (undocumented)
        f - (undocumented)
        Returns:
        (undocumented)
      • expectMsgClass

        public <T> T expectMsgClass​(java.lang.Class<T> c)
        Same as expectMsgClass(remainingOrDefault, c), but correctly treating the timeFactor.
        Parameters:
        c - (undocumented)
        Returns:
        (undocumented)
      • expectMsgClass

        public <T> T expectMsgClass​(scala.concurrent.duration.FiniteDuration max,
                                    java.lang.Class<T> c)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        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.
        Parameters:
        max - (undocumented)
        c - (undocumented)
        Returns:
        (undocumented)
      • expectMsgClass

        public <T> T expectMsgClass​(java.time.Duration max,
                                    java.lang.Class<T> c)
        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.
        Parameters:
        max - (undocumented)
        c - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAnyOf

        public <T> T expectMsgAnyOf​(scala.collection.Seq<T> objs)
        Same as expectMsgAnyOf(remainingOrDefault, obj...), but correctly treating the timeFactor.
        Parameters:
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAnyOf

        public <T> T expectMsgAnyOf​(scala.concurrent.duration.FiniteDuration max,
                                    scala.collection.Seq<T> objs)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        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.
        Parameters:
        max - (undocumented)
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAnyOf

        public <T> T expectMsgAnyOf​(java.time.Duration max,
                                    scala.collection.Seq<T> objs)
        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.
        Parameters:
        max - (undocumented)
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAllOf

        public <T> java.util.List<T> expectMsgAllOf​(scala.collection.Seq<T> objs)
        Same as expectMsgAllOf(remainingOrDefault, obj...), but correctly treating the timeFactor.
        Parameters:
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAllOf

        public <T> java.util.List<T> expectMsgAllOf​(scala.concurrent.duration.FiniteDuration max,
                                                    scala.collection.Seq<T> objs)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        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.
        Parameters:
        max - (undocumented)
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAllOf

        public <T> java.util.List<T> expectMsgAllOf​(java.time.Duration max,
                                                    scala.collection.Seq<T> objs)
        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.
        Parameters:
        max - (undocumented)
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAnyClassOf

        public <T> T expectMsgAnyClassOf​(scala.collection.Seq<java.lang.Class<?>> objs)
        Same as expectMsgAnyClassOf(remainingOrDefault, obj...), but correctly treating the timeFactor.
        Parameters:
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAnyClassOf

        public <T> T expectMsgAnyClassOf​(scala.concurrent.duration.FiniteDuration max,
                                         scala.collection.Seq<java.lang.Class<?>> objs)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        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.
        Parameters:
        max - (undocumented)
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectMsgAnyClassOf

        public <T> T expectMsgAnyClassOf​(java.time.Duration max,
                                         scala.collection.Seq<java.lang.Class<?>> objs)
        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.
        Parameters:
        max - (undocumented)
        objs - (undocumented)
        Returns:
        (undocumented)
      • expectNoMsg

        public void expectNoMsg()
        Deprecated.
        Use expectNoMessage instead. Since 2.5.10.
        Same as expectNoMsg(remainingOrDefault), but correctly treating the timeFactor.
      • expectNoMessage

        public void expectNoMessage()
        Same as expectNoMessage(remainingOrDefault), but correctly treating the timeFactor.
      • expectNoMsg

        public void expectNoMsg​(scala.concurrent.duration.FiniteDuration max)
        Deprecated.
        Use expectNoMessage instead. Since 2.5.10.
        Assert that no message is received for the specified time.
        Parameters:
        max - (undocumented)
      • expectNoMessage

        public void expectNoMessage​(scala.concurrent.duration.FiniteDuration max)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        Assert that no message is received for the specified time. Supplied value is not dilated.
        Parameters:
        max - (undocumented)
      • expectNoMessage

        public void expectNoMessage​(java.time.Duration max)
        Assert that no message is received for the specified time. Supplied value is not dilated.
        Parameters:
        max - (undocumented)
      • expectTerminated

        public Terminated expectTerminated​(scala.concurrent.duration.Duration max,
                                           ActorRef target)
        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.

        Parameters:
        max - wait no more than max time, otherwise throw AssertionFailure
        target - the actor ref expected to be Terminated
        Returns:
        the received Terminated message
      • expectTerminated

        public Terminated expectTerminated​(java.time.Duration max,
                                           ActorRef target)
        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.

        Parameters:
        max - wait no more than max time, otherwise throw AssertionFailure
        target - the actor ref expected to be Terminated
        Returns:
        the received Terminated message
      • expectTerminated

        public Terminated expectTerminated​(ActorRef target)
        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.

        Parameters:
        target - the actor ref expected to be Terminated
        Returns:
        the received Terminated message
      • fishForMessage

        public java.lang.Object fishForMessage​(scala.concurrent.duration.Duration max,
                                               java.lang.String hint,
                                               java.util.function.Function<java.lang.Object,​java.lang.Object> f)
        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.

        Parameters:
        max - (undocumented)
        hint - (undocumented)
        f - (undocumented)
        Returns:
        the last received message, i.e. the first one for which the partial function returned true
      • fishForSpecificMessage

        public <T> T fishForSpecificMessage​(scala.concurrent.duration.Duration max,
                                            java.lang.String hint,
                                            java.util.function.Function<java.lang.Object,​T> f)
        Same as fishForMessage, but gets a different partial function and returns properly typed message.
        Parameters:
        max - (undocumented)
        hint - (undocumented)
        f - (undocumented)
        Returns:
        (undocumented)
      • receiveN

        public java.util.List<java.lang.Object> receiveN​(int n)
        Same as receiveN(n, remaining) but correctly taking into account Duration.timeFactor.
        Parameters:
        n - (undocumented)
        Returns:
        (undocumented)
      • receiveN

        public java.util.List<java.lang.Object> receiveN​(int n,
                                                         scala.concurrent.duration.FiniteDuration max)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        Receive N messages in a row before the given deadline.
        Parameters:
        n - (undocumented)
        max - (undocumented)
        Returns:
        (undocumented)
      • receiveN

        public java.util.List<java.lang.Object> receiveN​(int n,
                                                         java.time.Duration max)
        Receive N messages in a row before the given deadline.
        Parameters:
        n - (undocumented)
        max - (undocumented)
        Returns:
        (undocumented)
      • receiveOne

        public java.lang.Object receiveOne​(scala.concurrent.duration.Duration max)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.13.
        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!

        Parameters:
        max - (undocumented)
        Returns:
        (undocumented)
      • receiveOne

        public java.lang.Object receiveOne​(java.time.Duration max)
        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!

        Parameters:
        max - (undocumented)
        Returns:
        (undocumented)
      • receiveWhile

        public <T> java.util.List<T> receiveWhile​(scala.concurrent.duration.Duration max,
                                                  scala.concurrent.duration.Duration idle,
                                                  int messages,
                                                  java.util.function.Function<java.lang.Object,​T> f)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.13.
        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:

        Parameters:
        max - (undocumented)
        idle - (undocumented)
        messages - (undocumented)
        f - (undocumented)
        Returns:
        (undocumented)
      • receiveWhile

        public <T> java.util.List<T> receiveWhile​(java.time.Duration max,
                                                  java.time.Duration idle,
                                                  int messages,
                                                  java.util.function.Function<java.lang.Object,​T> f)
        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:

        Parameters:
        max - (undocumented)
        idle - (undocumented)
        messages - (undocumented)
        f - (undocumented)
        Returns:
        (undocumented)
      • receiveWhile

        public <T> java.util.List<T> receiveWhile​(scala.concurrent.duration.Duration max,
                                                  java.util.function.Function<java.lang.Object,​T> f)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.13.
      • receiveWhile

        public <T> java.util.List<T> receiveWhile​(java.time.Duration max,
                                                  java.util.function.Function<java.lang.Object,​T> f)
      • childActorOf

        public ActorRef childActorOf​(Props props,
                                     java.lang.String name,
                                     SupervisorStrategy supervisorStrategy)
        Spawns an actor as a child of this test actor, and returns the child's ActorRef.
        Parameters:
        props - (undocumented)
        name - (undocumented)
        supervisorStrategy - (undocumented)
        Returns:
        (undocumented)
      • childActorOf

        public ActorRef childActorOf​(Props props,
                                     SupervisorStrategy supervisorStrategy)
        Spawns an actor as a child of this test actor with an auto-generated name, and returns the child's ActorRef.
        Parameters:
        props - (undocumented)
        supervisorStrategy - (undocumented)
        Returns:
        (undocumented)
      • childActorOf

        public ActorRef childActorOf​(Props props,
                                     java.lang.String name)
        Spawns an actor as a child of this test actor with a stopping supervisor strategy, and returns the child's ActorRef.
        Parameters:
        props - (undocumented)
        name - (undocumented)
        Returns:
        (undocumented)
      • childActorOf

        public ActorRef childActorOf​(Props props)
        Spawns an actor as a child of this test actor with an auto-generated name and stopping supervisor strategy, returning the child's ActorRef.
        Parameters:
        props - (undocumented)
        Returns:
        (undocumented)