Package akka.persistence.testkit.javadsl
Class EventSourcedBehaviorTestKit<Command,Event,State>
- java.lang.Object
- 
- akka.persistence.testkit.javadsl.EventSourcedBehaviorTestKit<Command,Event,State>
 
- 
 public final class EventSourcedBehaviorTestKit<Command,Event,State> extends java.lang.Object
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classEventSourcedBehaviorTestKit.CommandResult<Command,Event,State>The result of running a command.static classEventSourcedBehaviorTestKit.CommandResultWithReply<Command,Event,State,Reply>The result of running a command with aActorRef, i.e.replyTo static classEventSourcedBehaviorTestKit.RestartResult<State>The result of restarting the behavior.static classEventSourcedBehaviorTestKit.SerializationSettingsCustomization of which serialization checks that are performed.
 - 
Constructor SummaryConstructors Constructor Description EventSourcedBehaviorTestKit(EventSourcedBehaviorTestKit<Command,Event,State> delegate)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the in-memory journal and snapshot storage and restarts the behavior.static com.typesafe.config.Configconfig()The configuration to be included in the configuration of theActorSystem.static <Command,Event,State>
 EventSourcedBehaviorTestKit<Command,Event,State>create(ActorSystem<?> system, Behavior<Command> behavior)Factory method to create a new EventSourcedBehaviorTestKit.static <Command,Event,State>
 EventSourcedBehaviorTestKit<Command,Event,State>create(ActorSystem<?> system, Behavior<Command> behavior, EventSourcedBehaviorTestKit.SerializationSettings serializationSettings)Factory method to create a new EventSourcedBehaviorTestKit with customEventSourcedBehaviorTestKit.SerializationSettings.static EventSourcedBehaviorTestKit.SerializationSettingsdisabledSerializationSettings()static EventSourcedBehaviorTestKit.SerializationSettingsenabledSerializationSettings()StategetState()Retrieve the current state of the Behavior.voidinitialize(java.lang.Object... events)voidinitialize(scala.collection.immutable.Seq<Event> events)voidinitialize(State state, java.lang.Object... events)Initializes behavior from provided state and/or events.voidinitialize(State state, scala.collection.immutable.Seq<Event> events)Initializes behavior from provided state and/or events.PersistenceTestKitpersistenceTestKit()The underlyingPersistenceTestKitfor the in-memory journal.EventSourcedBehaviorTestKit.RestartResult<State>restart()Restart the behavior, which will then recover from stored snapshot and events.EventSourcedBehaviorTestKit.CommandResult<Command,Event,State>runCommand(Command command)Run one command through the behavior.<R> EventSourcedBehaviorTestKit.CommandResultWithReply<Command,Event,State,R>runCommand(java.util.function.Function<ActorRef<R>,Command> creator)Run one command with areplyTo: ActorRefthrough the behavior.java.util.Optional<SnapshotTestKit>snapshotTestKit()The underlyingSnapshotTestKitfor snapshot storage.
 
- 
- 
- 
Constructor Detail- 
EventSourcedBehaviorTestKitpublic EventSourcedBehaviorTestKit(EventSourcedBehaviorTestKit<Command,Event,State> delegate) 
 
- 
 - 
Method Detail- 
configpublic static com.typesafe.config.Config config() The configuration to be included in the configuration of theActorSystem. Typically used as constructor parameter toTestKitJunitResource. The configuration enables the in-memory journal and snapshot storage.
 - 
enabledSerializationSettingspublic static EventSourcedBehaviorTestKit.SerializationSettings enabledSerializationSettings() 
 - 
disabledSerializationSettingspublic static EventSourcedBehaviorTestKit.SerializationSettings disabledSerializationSettings() 
 - 
createpublic static <Command,Event,State> EventSourcedBehaviorTestKit<Command,Event,State> create(ActorSystem<?> system, Behavior<Command> behavior) Factory method to create a new EventSourcedBehaviorTestKit.
 - 
createpublic static <Command,Event,State> EventSourcedBehaviorTestKit<Command,Event,State> create(ActorSystem<?> system, Behavior<Command> behavior, EventSourcedBehaviorTestKit.SerializationSettings serializationSettings) Factory method to create a new EventSourcedBehaviorTestKit with customEventSourcedBehaviorTestKit.SerializationSettings.Note that equalsmust be implemented in the commands, events and state ifverifyEqualityis enabled.
 - 
initializepublic void initialize(State state, java.lang.Object... events) Initializes behavior from provided state and/or events.
 - 
initializepublic void initialize(java.lang.Object... events) 
 - 
runCommandpublic EventSourcedBehaviorTestKit.CommandResult<Command,Event,State> runCommand(Command command) Run one command through the behavior. The returned result contains emitted events and the state after applying the events.
 - 
runCommandpublic <R> EventSourcedBehaviorTestKit.CommandResultWithReply<Command,Event,State,R> runCommand(java.util.function.Function<ActorRef<R>,Command> creator) Run one command with areplyTo: ActorRefthrough the behavior. The returned result contains emitted events, the state after applying the events, and the reply.
 - 
getStatepublic State getState() Retrieve the current state of the Behavior.
 - 
restartpublic 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.
 - 
clearpublic void clear() Clears the in-memory journal and snapshot storage and restarts the behavior.
 - 
initializepublic void initialize(State state, scala.collection.immutable.Seq<Event> events) Initializes behavior from provided state and/or events.
 - 
initializepublic void initialize(scala.collection.immutable.Seq<Event> events) 
 - 
persistenceTestKitpublic 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.
 - 
snapshotTestKitpublic java.util.Optional<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.
 
- 
 
-