Class EventSourcedBehaviorTestKitImpl<Command,Event,State>
- java.lang.Object
-
- akka.persistence.testkit.internal.EventSourcedBehaviorTestKitImpl<Command,Event,State>
-
- All Implemented Interfaces:
EventSourcedBehaviorTestKit<Command,Event,State>
public class EventSourcedBehaviorTestKitImpl<Command,Event,State> extends java.lang.Object implements EventSourcedBehaviorTestKit<Command,Event,State>
INTERNAL API
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EventSourcedBehaviorTestKitImpl.CommandResultImpl<Command,Event,State,Reply>
static class
EventSourcedBehaviorTestKitImpl.CommandResultImpl$
static class
EventSourcedBehaviorTestKitImpl.RestartResultImpl<State>
static class
EventSourcedBehaviorTestKitImpl.RestartResultImpl$
-
Nested classes/interfaces inherited from interface akka.persistence.testkit.scaladsl.EventSourcedBehaviorTestKit
EventSourcedBehaviorTestKit.CommandResult<Command,Event,State>, EventSourcedBehaviorTestKit.CommandResultWithReply<Command,Event,State,Reply>, EventSourcedBehaviorTestKit.RestartResult<State>, EventSourcedBehaviorTestKit.SerializationSettings, EventSourcedBehaviorTestKit.SerializationSettings$
-
-
Constructor Summary
Constructors Constructor Description EventSourcedBehaviorTestKitImpl(ActorTestKit actorTestKit, Behavior<Command> behavior, EventSourcedBehaviorTestKit.SerializationSettings serializationSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears the in-memory journal and snapshot storage and restarts the behavior.State
getState()
Retrieve the current state of the Behavior.PersistenceTestKit
persistenceTestKit()
The underlyingPersistenceTestKit
for the in-memory journal and snapshot storage.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(scala.Function1<ActorRef<R>,Command> creator)
Run one command with areplyTo: ActorRef[R]
through the behavior.
-
-
-
Constructor Detail
-
EventSourcedBehaviorTestKitImpl
public EventSourcedBehaviorTestKitImpl(ActorTestKit actorTestKit, Behavior<Command> behavior, EventSourcedBehaviorTestKit.SerializationSettings serializationSettings)
-
-
Method Detail
-
persistenceTestKit
public PersistenceTestKit persistenceTestKit()
Description copied from interface:EventSourcedBehaviorTestKit
The underlyingPersistenceTestKit
for the in-memory journal and snapshot storage. Can be useful for advanced testing scenarios, such as simulating failures or populating the journal with events that are used for replay.- Specified by:
persistenceTestKit
in interfaceEventSourcedBehaviorTestKit<Command,Event,State>
-
runCommand
public EventSourcedBehaviorTestKit.CommandResult<Command,Event,State> runCommand(Command command)
Description copied from interface:EventSourcedBehaviorTestKit
Run one command through the behavior. The returned result contains emitted events and the state after applying the events.- Specified by:
runCommand
in interfaceEventSourcedBehaviorTestKit<Command,Event,State>
-
runCommand
public <R> EventSourcedBehaviorTestKit.CommandResultWithReply<Command,Event,State,R> runCommand(scala.Function1<ActorRef<R>,Command> creator)
Description copied from interface:EventSourcedBehaviorTestKit
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.- Specified by:
runCommand
in interfaceEventSourcedBehaviorTestKit<Command,Event,State>
-
getState
public State getState()
Description copied from interface:EventSourcedBehaviorTestKit
Retrieve the current state of the Behavior.- Specified by:
getState
in interfaceEventSourcedBehaviorTestKit<Command,Event,State>
-
restart
public EventSourcedBehaviorTestKit.RestartResult<State> restart()
Description copied from interface:EventSourcedBehaviorTestKit
Restart the behavior, which will then recover from stored snapshot and events. Can be used for testing that the recovery is correct.- Specified by:
restart
in interfaceEventSourcedBehaviorTestKit<Command,Event,State>
-
clear
public void clear()
Description copied from interface:EventSourcedBehaviorTestKit
Clears the in-memory journal and snapshot storage and restarts the behavior.- Specified by:
clear
in interfaceEventSourcedBehaviorTestKit<Command,Event,State>
-
-