Class TestInbox<T>

  • Direct Known Subclasses:
    TestInboxImpl

    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
        Returns:
        (undocumented)
      • receiveMessage

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

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

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

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

        public abstract boolean hasMessages()