Class EventSourcedBehaviorTestKit.CommandResult<Command,Event,State>
- java.lang.Object
-
- org.apache.pekko.persistence.testkit.javadsl.EventSourcedBehaviorTestKit.CommandResult<Command,Event,State>
-
- Direct Known Subclasses:
EventSourcedBehaviorTestKit.CommandResultWithReply
- Enclosing class:
- EventSourcedBehaviorTestKit<Command,Event,State>
public static class EventSourcedBehaviorTestKit.CommandResult<Command,Event,State> extends java.lang.Object
The result of running a command.
-
-
Constructor Summary
Constructors Constructor Description CommandResult(EventSourcedBehaviorTestKit.CommandResult<Command,Event,State> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Command
command()
The command that was run.Event
event()
The first event.<E extends Event>
EeventOfType(java.lang.Class<E> eventClass)
The first event as a given expected type.java.util.List<Event>
events()
The events that were emitted by the command, and persisted.boolean
hasNoEvents()
true
if no events were emitted by the command.State
state()
The state after applying the events.<S extends State>
SstateOfType(java.lang.Class<S> stateClass)
The state as a given expected type.
-
-
-
Constructor Detail
-
CommandResult
public CommandResult(EventSourcedBehaviorTestKit.CommandResult<Command,Event,State> delegate)
-
-
Method Detail
-
command
public Command command()
The command that was run.
-
event
public Event event()
The first event. It will throwAssertionError
if there is no event.
-
eventOfType
public <E extends Event> E eventOfType(java.lang.Class<E> eventClass)
The first event as a given expected type. It will throwAssertionError
if there is no event or if the event is of a different type.
-
events
public java.util.List<Event> events()
The events that were emitted by the command, and persisted. In many cases only one event is emitted and then it's more convenient to useCommandResult.event
orCommandResult.eventOfType
.
-
hasNoEvents
public boolean hasNoEvents()
true
if no events were emitted by the command.
-
state
public State state()
The state after applying the events.
-
stateOfType
public <S extends State> S stateOfType(java.lang.Class<S> stateClass)
The state as a given expected type. It will throwAssertionError
if the state is of a different type.
-
-