Package akka.testkit

Class JavaTestKit.ReceiveWhile<T>

  • Enclosing class:

    public abstract class JavaTestKit.ReceiveWhile<T>
    extends java.lang.Object
    Receive a series of messages until one does not match the given match function or the idle timeout is met (disabled by default) or the overall maximum duration is elapsed. 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.

    • Constructor Summary

      Constructor Description
      ReceiveWhile​(java.lang.Class<T> clazz)  
      ReceiveWhile​(java.lang.Class<T> clazz, scala.concurrent.duration.Duration max)  
      ReceiveWhile​(java.lang.Class<T> clazz, scala.concurrent.duration.Duration max, int messages)  
      ReceiveWhile​(java.lang.Class<T> clazz, scala.concurrent.duration.Duration max, scala.concurrent.duration.Duration idle, int messages)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      T[] get()  
      protected abstract T match​(java.lang.Object msg)  
      protected java.lang.RuntimeException noMatch()  
      • Methods inherited from class java.lang.Object

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

      • ReceiveWhile

        public ReceiveWhile​(java.lang.Class<T> clazz)
      • ReceiveWhile

        public ReceiveWhile​(java.lang.Class<T> clazz,
                            scala.concurrent.duration.Duration max)
      • ReceiveWhile

        public ReceiveWhile​(java.lang.Class<T> clazz,
                            scala.concurrent.duration.Duration max,
                            int messages)
      • ReceiveWhile

        public ReceiveWhile​(java.lang.Class<T> clazz,
                            scala.concurrent.duration.Duration max,
                            scala.concurrent.duration.Duration idle,
                            int messages)
    • Method Detail

      • match

        protected abstract T match​(java.lang.Object msg)
                            throws java.lang.Exception
      • noMatch

        protected java.lang.RuntimeException noMatch()
      • get

        public T[] get()