Class EventSourcedBehaviorTestKit<Command,​Event,​State>


  • public final class EventSourcedBehaviorTestKit<Command,​Event,​State>
    extends java.lang.Object
    • Method Detail

      • config

        public static com.typesafe.config.Config config()
        The configuration to be included in the configuration of the ActorSystem. Typically used as constructor parameter to TestKitJunitResource. The configuration enables the in-memory journal and snapshot storage.
      • create

        public static <Command,​Event,​State> EventSourcedBehaviorTestKit<Command,​Event,​State> create​(ActorSystem<?> system,
                                                                                                                            Behavior<Command> behavior)
        Factory method to create a new EventSourcedBehaviorTestKit.
      • initialize

        public void initialize​(State state,
                               java.lang.Object... events)
        Initializes behavior from provided state and/or events.
      • initialize

        public void initialize​(java.lang.Object... events)
      • getState

        public State getState()
        Retrieve the current state of the Behavior.
      • clear

        public void clear()
        Clears the in-memory journal and snapshot storage and restarts the behavior.
      • initialize

        public void initialize​(State state,
                               scala.collection.immutable.Seq<Event> events)
        Initializes behavior from provided state and/or events.
      • initialize

        public void initialize​(scala.collection.immutable.Seq<Event> events)
      • persistenceTestKit

        public PersistenceTestKit persistenceTestKit()
        The underlying PersistenceTestKit for the in-memory journal. Can be useful for advanced testing scenarios, such as simulating failures or populating the journal with events that are used for replay.
      • snapshotTestKit

        public java.util.Optional<SnapshotTestKit> snapshotTestKit()
        The underlying SnapshotTestKit for snapshot storage. Present only if snapshots are enabled. Can be useful for advanced testing scenarios, such as simulating failures or populating the storage with snapshots that are used for replay.