Class TestInbox<T>

java.lang.Object
org.apache.pekko.actor.testkit.typed.javadsl.TestInbox<T>

public abstract class TestInbox<T> extends Object
Utility for use as an ActorRef when *synchronously* testing pekko.actor.typed.Behavior with pekko.actor.testkit.typed.javadsl.BehaviorTestKit.

If you plan to use a real pekko.actor.typed.ActorSystem then use pekko.actor.testkit.typed.javadsl.TestProbe for asynchronous testing.

Use TestInbox.create factory methods to create instances

Not for user extension

  • Constructor Details

    • TestInbox

      public TestInbox()
  • Method Details

    • create

      public static <T> TestInbox<T> create(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 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()