Interface ContinuedGivenState

All Superinterfaces:
WhenState
All Known Implementing Classes:
SagaTestFixture

public interface ContinuedGivenState extends WhenState
Interface describing methods that can be executed after the first "given" state has been supplied. Either more "given" state can be appended, or a transition to the definition of "when" can be made.
Since:
1.1
Author:
Allard Buijze
  • Method Details

    • andThenAggregate

      GivenAggregateEventPublisher andThenAggregate(String aggregateIdentifier)
      Use this method to indicate that an aggregate with given identifier published certain events.

      Can be chained to build natural sentences:
      andThenAggregate(someIdentifier).published(someEvents)

      Parameters:
      aggregateIdentifier - The identifier of the aggregate the events should appear to come from
      Returns:
      an object that allows registration of the actual events to send
    • andThenTimeElapses

      ContinuedGivenState andThenTimeElapses(Duration elapsedTime) throws Exception
      Simulate time shifts in the current given state. This can be useful when the time between given events is of importance.
      Parameters:
      elapsedTime - The amount of time that will elapse
      Returns:
      an object that allows registration of the actual events to send
      Throws:
      Exception - if an exception happens when the duration elapses
    • andThenTimeAdvancesTo

      ContinuedGivenState andThenTimeAdvancesTo(Instant newDateTime) throws Exception
      Simulate time shifts in the current given state. This can be useful when the time between given events is of importance.
      Parameters:
      newDateTime - The time to advance the clock to
      Returns:
      an object that allows registration of the actual events to send
      Throws:
      Exception - if an exception happens when the time advances
    • andThenAPublished

      ContinuedGivenState andThenAPublished(Object event)
      Indicates that the given event has been published in the past. This event is sent to the associated sagas.
      Parameters:
      event - The event to publish
      Returns:
      an object that allows chaining of more given state
      Throws:
      Exception - if an exception happens when the event is handled
    • andThenAPublished

      ContinuedGivenState andThenAPublished(Object event, Map<String,?> metaData)
      Indicates that the given event with given metaData has been published in the past. This event is sent to the associated sagas.
      Parameters:
      event - The event to publish
      metaData - The meta data to attach to the event
      Returns:
      an object that allows chaining of more given state
      Throws:
      Exception - if an exception happens when the event is handled