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 Object
The result of running a command.
  • Constructor Details

  • Method Details

    • command

      public Command command()
      The command that was run.
    • event

      public Event event()
      The first event. It will throw AssertionError if there is no event.
    • eventOfType

      public <E extends Event> E eventOfType(Class<E> eventClass)
      The first event as a given expected type. It will throw AssertionError if there is no event or if the event is of a different type.
    • events

      public 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 use CommandResult.event or CommandResult.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(Class<S> stateClass)
      The state as a given expected type. It will throw AssertionError if the state is of a different type.