Interface EventSourcedBehaviorTestKit<Command,Event,State>
public interface EventSourcedBehaviorTestKit<Command,Event,State>
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe result of running a command.static interfaceThe result of running a command with areplyTo: ActorRef[R], i.e.static interfaceThe result of restarting the behavior.static final classCustomization of which serialization checks that are performed.static class -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the in-memory journal and snapshot storage and restarts the behavior.getState()Retrieve the current state of the Behavior.voidinitialize(scala.collection.immutable.Seq<Event> events) voidinitialize(State state, scala.collection.immutable.Seq<Event> events) Initializes behavior from provided state and/or events.The underlyingPersistenceTestKitfor the in-memory journal.restart()Restart the behavior, which will then recover from stored snapshot and events.runCommand(Command command) Run one command through the behavior.runCommand(scala.Function1<ActorRef<R>, Command> creator) Run one command with areplyTo: ActorRef[R]through the behavior.scala.Option<SnapshotTestKit>The underlyingSnapshotTestKitfor snapshot storage.
-
Method Details
-
runCommand
Run one command through the behavior. The returned result contains emitted events and the state after applying the events. -
runCommand
<R> EventSourcedBehaviorTestKit.CommandResultWithReply<Command,Event, runCommandState, R> (scala.Function1<ActorRef<R>, Command> creator) Run one command with areplyTo: ActorRef[R]through the behavior. The returned result contains emitted events, the state after applying the events, and the reply. -
getState
State getState()Retrieve the current state of the Behavior. -
restart
EventSourcedBehaviorTestKit.RestartResult<State> restart()Restart the behavior, which will then recover from stored snapshot and events. Can be used for testing that the recovery is correct. -
clear
void clear()Clears the in-memory journal and snapshot storage and restarts the behavior. -
persistenceTestKit
PersistenceTestKit persistenceTestKit()The underlyingPersistenceTestKitfor 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
scala.Option<SnapshotTestKit> snapshotTestKit()The underlyingSnapshotTestKitfor 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. -
initialize
Initializes behavior from provided state and/or events. -
initialize
-