Class TestInbox<T>

  • public abstract class TestInbox<T>
    extends java.lang.Object
    Utility for use as an ActorRef when *synchronously* testing Behavior with BehaviorTestKit.

    If you plan to use a real ActorSystem then use TestProbe for asynchronous testing.

    Use TestInbox.create factory methods to create instances

    Not for user extension

    • Constructor Detail

      • TestInbox

        public TestInbox()
    • Method Detail

      • create

        public static <T> TestInbox<T> create​(java.lang.String name)
      • create

        public static <T> TestInbox<T> create()
      • getRef

        public abstract ActorRef<T> getRef()
        The actor ref of the inbox
      • receiveMessage

        public abstract T receiveMessage()
        Get and remove the oldest message
      • expectMessage

        public abstract TestInbox<T> expectMessage​(T expectedMessage)
        Assert and remove the the oldest message.
      • getAllReceived

        public java.util.List<T> getAllReceived()
        Collect all messages in the inbox and clear it out
      • internalReceiveAll

        protected abstract scala.collection.immutable.Seq<T> internalReceiveAll()
      • hasMessages

        public abstract boolean hasMessages()