Interface FixtureExecutionResult

All Known Implementing Classes:
FixtureExecutionResultImpl

public interface FixtureExecutionResult
Interface towards an object that contains the results of a Fixture execution. It provides methods to assert that certain actions have taken place.
Since:
1.1
Author:
Allard Buijze
  • Method Details

    • expectActiveSagas

      FixtureExecutionResult expectActiveSagas(int expected)
      Expect the given number of Sagas to be active (i.e. ready to respond to incoming events.
      Parameters:
      expected - the expected number of active events in the repository
      Returns:
      the FixtureExecutionResult for method chaining
    • expectAssociationWith

      FixtureExecutionResult expectAssociationWith(String associationKey, Object associationValue)
      Asserts that at least one of the active sagas is associated with the given associationKey and associationValue.
      Parameters:
      associationKey - The key of the association to verify
      associationValue - The value of the association to verify
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoAssociationWith

      FixtureExecutionResult expectNoAssociationWith(String associationKey, Object associationValue)
      Asserts that at none of the active sagas is associated with the given associationKey and associationValue.
      Parameters:
      associationKey - The key of the association to verify
      associationValue - The value of the association to verify
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledEventMatching

      FixtureExecutionResult expectScheduledEventMatching(Duration duration, org.hamcrest.Matcher<? super EventMessage<?>> matcher)
      Asserts that an event matching the given matcher has been scheduled to be published after the given duration.
      Parameters:
      duration - The time to wait before the event should be published
      matcher - A matcher defining the event expected to be published
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledDeadlineMatching

      FixtureExecutionResult expectScheduledDeadlineMatching(Duration duration, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
      Asserts that a deadline scheduled after given duration matches the given matcher.
      Parameters:
      duration - The delay expected before the deadline is met
      matcher - The matcher that must match with the deadline scheduled at the given time
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledEvent

      FixtureExecutionResult expectScheduledEvent(Duration duration, Object event)
      Asserts that an event equal to the given event has been scheduled for publication after the given duration.

      Note that the source attribute of the event is ignored when comparing events. Events are compared using an "equals" check on all fields in the events.

      Parameters:
      duration - The time to wait before the event should be published
      event - The expected event
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledDeadline

      FixtureExecutionResult expectScheduledDeadline(Duration duration, Object deadline)
      Asserts that a deadline equal to the given deadline has been scheduled after the given duration.

      Note that the source attribute of the deadline is ignored when comparing deadlines. Deadlines are compared using an "equals" check on all fields in the deadlines.

      Parameters:
      duration - The time to wait before the deadline should be met
      deadline - The expected deadline
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledEventOfType

      FixtureExecutionResult expectScheduledEventOfType(Duration duration, Class<?> eventType)
      Asserts that an event of the given eventType has been scheduled for publication after the given duration.
      Parameters:
      duration - The time to wait before the event should be published
      eventType - The type of the expected event
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledDeadlineOfType

      FixtureExecutionResult expectScheduledDeadlineOfType(Duration duration, Class<?> deadlineType)
      Asserts that a deadline of the given deadlineType has been scheduled after the given duration.
      Parameters:
      duration - The time to wait before the deadline is met
      deadlineType - The type of the expected deadline
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledDeadlineWithName

      FixtureExecutionResult expectScheduledDeadlineWithName(Duration duration, String deadlineName)
      Asserts that a deadline with the given deadlineName has been scheduled after the given duration.
      Parameters:
      duration - the time to wait before the deadline is met
      deadlineName - the name of the expected deadline
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledEventMatching

      FixtureExecutionResult expectScheduledEventMatching(Instant scheduledTime, org.hamcrest.Matcher<? super EventMessage<?>> matcher)
      Asserts that an event matching the given matcher has been scheduled to be published at the given scheduledTime.

      If the scheduledTime is calculated based on the "current time", use the FixtureConfiguration.currentTime() to get the time to use as "current time".

      Parameters:
      scheduledTime - The time at which the event should be published
      matcher - A matcher defining the event expected to be published
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledDeadlineMatching

      FixtureExecutionResult expectScheduledDeadlineMatching(Instant scheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
      Asserts that a deadline matching the given matcher has been scheduled at the given scheduledTime.

      If the scheduledTime is calculated based on the "current time", use the FixtureConfiguration.currentTime() to get the time to use as "current time".

      Parameters:
      scheduledTime - The time at which the deadline should be met
      matcher - The matcher defining the deadline expected
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledEvent

      FixtureExecutionResult expectScheduledEvent(Instant scheduledTime, Object event)
      Asserts that an event equal to the given event has been scheduled for publication at the given scheduledTime.

      If the scheduledTime is calculated based on the "current time", use the FixtureConfiguration.currentTime() to get the time to use as "current time".

      Note that the source attribute of the event is ignored when comparing events. Events are compared using an "equals" check on all fields in the events.

      Parameters:
      scheduledTime - The time at which the event should be published
      event - The expected event
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledDeadline

      FixtureExecutionResult expectScheduledDeadline(Instant scheduledTime, Object deadline)
      Asserts that a deadline equal to the given deadline has been scheduled at the given scheduledTime.

      If the scheduledTime is calculated based on the "current time", use the FixtureConfiguration.currentTime() to get the time to use as "current time".

      Note that the source attribute of the deadline is ignored when comparing deadlines. Deadlines are compared using an "equals" check on all fields in the deadlines.

      Parameters:
      scheduledTime - The time at which the deadline is scheduled
      deadline - The expected deadline
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledEventOfType

      FixtureExecutionResult expectScheduledEventOfType(Instant scheduledTime, Class<?> eventType)
      Asserts that an event of the given eventType has been scheduled for publication at the given scheduledTime.

      If the scheduledTime is calculated based on the "current time", use the FixtureConfiguration.currentTime() to get the time to use as "current time".

      Parameters:
      scheduledTime - The time at which the event should be published
      eventType - The type of the expected event
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledDeadlineOfType

      FixtureExecutionResult expectScheduledDeadlineOfType(Instant scheduledTime, Class<?> deadlineType)
      Asserts that a deadline of the given deadlineType has been scheduled at the given scheduledTime.
      Parameters:
      scheduledTime - The time at which the deadline is scheduled
      deadlineType - The type of the expected deadline
      Returns:
      the FixtureExecutionResult for method chaining
    • expectScheduledDeadlineWithName

      FixtureExecutionResult expectScheduledDeadlineWithName(Instant scheduledTime, String deadlineName)
      Asserts that a deadline with the given deadlineName has been scheduled at the given scheduledTime.
      Parameters:
      scheduledTime - the time at which the deadline is scheduled
      deadlineName - the name of the expected deadline
      Returns:
      the FixtureExecutionResult for method chaining
    • expectDispatchedCommands

      FixtureExecutionResult expectDispatchedCommands(Object... commands)
      Asserts that the given commands have been dispatched in exactly the order given. The command objects are compared using the equals method. Only commands as a result of the event in the "when" stage of the fixture are compared.

      If exact order doesn't matter, or the validation needs be done in another way than "equal payload", consider using expectDispatchedCommandsMatching(Matcher) instead.

      Parameters:
      commands - The expected commands
      Returns:
      the FixtureExecutionResult for method chaining
    • expectDispatchedCommandsMatching

      FixtureExecutionResult expectDispatchedCommandsMatching(org.hamcrest.Matcher<? extends List<? super CommandMessage<?>>> matcher)
      Asserts that the sagas dispatched commands as defined by the given matcher. Only commands as a result of the event in the "when" stage of the fixture are matched.
      Parameters:
      matcher - The matcher that describes the expected list of commands
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoDispatchedCommands

      FixtureExecutionResult expectNoDispatchedCommands()
      Asserts that the sagas did not dispatch any commands. Only commands as a result of the event in the "when" stage of ths fixture are recorded.
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledEvents

      FixtureExecutionResult expectNoScheduledEvents()
      Assert that no events are scheduled for publication. This means that either no events were scheduled at all, all schedules have been cancelled or all scheduled events have been published already.
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledEventMatching

      FixtureExecutionResult expectNoScheduledEventMatching(Duration durationToScheduledTime, org.hamcrest.Matcher<? super EventMessage<?>> matcher)
      Asserts that no event matching the given matcher has been scheduled to be published after the given durationToScheduledTime.
      Parameters:
      durationToScheduledTime - the time to wait until the trigger point of the event which should not be scheduled
      matcher - the matcher defining the event which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledEvent

      FixtureExecutionResult expectNoScheduledEvent(Duration durationToScheduledTime, Object event)
      Asserts that no event equal to the given event has been scheduled after the given durationToScheduledTime.

      Note that the source attribute of the event is ignored when comparing events. Events are compared using an "equals" check on all fields in the events.

      Parameters:
      durationToScheduledTime - the time to wait until the trigger point of the event which should not be scheduled
      event - the event which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledEventOfType

      FixtureExecutionResult expectNoScheduledEventOfType(Duration durationToScheduledTime, Class<?> eventType)
      Asserts that no event of the given eventType has been scheduled after the given durationToScheduledTime.
      Parameters:
      durationToScheduledTime - the time to wait until the trigger point of the event which should not be scheduled
      eventType - the type of the event which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledEventMatching

      FixtureExecutionResult expectNoScheduledEventMatching(Instant scheduledTime, org.hamcrest.Matcher<? super EventMessage<?>> matcher)
      Asserts that no event matching the given matcher has been scheduled at the given scheduledTime.

      If the scheduledTime is calculated based on the "current time", use the TestExecutor.currentTime() to get the time to use as "current time".

      Parameters:
      scheduledTime - the time at which no event matching the given matcher should be scheduled
      matcher - the matcher defining the event which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledEvent

      FixtureExecutionResult expectNoScheduledEvent(Instant scheduledTime, Object event)
      Asserts that no event equal to the given event has been scheduled at the given scheduledTime.

      If the scheduledTime is calculated based on the "current time", use the TestExecutor.currentTime() to get the time to use as "current time".

      Note that the source attribute of the event is ignored when comparing events. Events are compared using an "equals" check on all fields in the events.

      Parameters:
      scheduledTime - the time at which no event equal to the given event should be scheduled
      event - the event which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledEventOfType

      FixtureExecutionResult expectNoScheduledEventOfType(Instant scheduledTime, Class<?> eventType)
      Asserts that no event with the given eventType has been scheduled at the given scheduledTime.
      Parameters:
      scheduledTime - the time at which no event of eventType should be scheduled
      eventType - the type of the event which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledDeadlines

      FixtureExecutionResult expectNoScheduledDeadlines()
      Asserts that no deadlines are scheduled. This means that either no deadlines were scheduled at all, all schedules have been cancelled or all scheduled deadlines have been met already.
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledDeadlineMatching

      FixtureExecutionResult expectNoScheduledDeadlineMatching(org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
      Asserts that no deadline matching the given matcher is scheduled. Can be used to validate if a deadline has never been set or has been canceled.
      Parameters:
      matcher - the matcher defining the deadline which should not be scheduled
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadlineMatching

      FixtureExecutionResult expectNoScheduledDeadlineMatching(Duration durationToScheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
      Asserts that no deadline matching the given matcher should be scheduled after the given durationToScheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time.
      Parameters:
      durationToScheduledTime - the time to wait until the trigger point of the deadline which should not be scheduled
      matcher - the matcher defining the deadline which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledDeadline

      FixtureExecutionResult expectNoScheduledDeadline(Duration durationToScheduledTime, Object deadline)
      Asserts that no deadline equal to the given deadline has been scheduled after the given durationToScheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time.

      Note that the source attribute of the deadline is ignored when comparing deadlines. Deadlines are compared using an "equals" check on all fields in the deadlines.

      Parameters:
      durationToScheduledTime - the time to wait until the trigger point of the deadline which should not be scheduled
      deadline - the deadline which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledDeadlineOfType

      FixtureExecutionResult expectNoScheduledDeadlineOfType(Duration durationToScheduledTime, Class<?> deadlineType)
      Asserts that no deadline of the given deadlineType has been scheduled at the given durationToScheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time.
      Parameters:
      durationToScheduledTime - the time to wait until the trigger point of the deadline which should not be scheduled
      deadlineType - the type of the deadline which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledDeadlineWithName

      FixtureExecutionResult expectNoScheduledDeadlineWithName(Duration durationToScheduledTime, String deadlineName)
      Asserts that no deadline with the given deadlineName has been scheduled after the given durationToScheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time.
      Parameters:
      durationToScheduledTime - the time to wait until the trigger point of the deadline which should not be scheduled
      deadlineName - the name of the deadline which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledDeadlineMatching

      FixtureExecutionResult expectNoScheduledDeadlineMatching(Instant scheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
      Asserts that no deadline matching the given matcher has been scheduled at the given scheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time.

      If the scheduledTime is calculated based on the "current time", use the TestExecutor.currentTime() to get the time to use as "current time".

      Parameters:
      scheduledTime - the time at which no deadline matching the given matcher should be scheduled
      matcher - the matcher defining the deadline which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledDeadline

      FixtureExecutionResult expectNoScheduledDeadline(Instant scheduledTime, Object deadline)
      Asserts that no deadline equal to the given deadline has been scheduled at the given scheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time.

      If the scheduledTime is calculated based on the "current time", use the TestExecutor.currentTime() to get the time to use as "current time".

      Note that the source attribute of the deadline is ignored when comparing deadlines. Deadlines are compared using an "equals" check on all fields in the deadlines.

      Parameters:
      scheduledTime - the time at which no deadline equal to the given deadline should be scheduled
      deadline - the deadline which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledDeadlineOfType

      FixtureExecutionResult expectNoScheduledDeadlineOfType(Instant scheduledTime, Class<?> deadlineType)
      Asserts that no deadline with the given deadlineType has been scheduled at the given scheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time.
      Parameters:
      scheduledTime - the time at which no deadline of deadlineType should be scheduled
      deadlineType - the type of the deadline which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledDeadlineWithName

      FixtureExecutionResult expectNoScheduledDeadlineWithName(Instant scheduledTime, String deadlineName)
      Asserts that no deadline with the given deadlineName has been scheduled at the given scheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time.
      Parameters:
      scheduledTime - the time at which no deadline of deadlineName should be scheduled
      deadlineName - the name of the deadline which should not be scheduled
      Returns:
      the FixtureExecutionResult for method chaining
    • expectNoScheduledDeadlineMatching

      FixtureExecutionResult expectNoScheduledDeadlineMatching(Instant from, Instant to, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
      Asserts that no deadline matching the given matcher has been scheduled between the to and from times, where to and from are inclusive. Can be used to validate if a deadline has never been set or has been canceled within a given timeframe.
      Parameters:
      from - the time from which no deadline equal to the given deadline should be scheduled (inclusive)
      to - the time until which no deadline equal to the given deadline should be scheduled (inclusive)
      matcher - the matcher defining the deadline which should not be scheduled
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadline

      FixtureExecutionResult expectNoScheduledDeadline(Instant from, Instant to, Object deadline)
      Asserts that no deadline equal to the given deadline has been scheduled between the to and from times, where to and from are inclusive. Can be used to validate if a deadline has never been set or has been canceled within a given timeframe.
      Parameters:
      from - the time from which no deadline equal to the given deadline should be scheduled (inclusive)
      to - the time until which no deadline equal to the given deadline should be scheduled (inclusive)
      deadline - the deadline which should not be scheduled
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadlineOfType

      FixtureExecutionResult expectNoScheduledDeadlineOfType(Instant from, Instant to, Class<?> deadlineType)
      Asserts that no deadline with the given deadlineType has been scheduled between the to and from times, where to and from are inclusive. Can be used to validate if a deadline has never been set or has been canceled within a given timeframe.
      Parameters:
      from - the time from which no deadline equal to the given deadline should be scheduled (inclusive)
      to - the time until which no deadline equal to the given deadline should be scheduled (inclusive)
      deadlineType - the type of the deadline which should not be scheduled
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadlineWithName

      FixtureExecutionResult expectNoScheduledDeadlineWithName(Instant from, Instant to, String deadlineName)
      Asserts that no deadline with the given deadlineName has been scheduled between the to and from times, where to and from are inclusive. Can be used to validate if a deadline has never been set or has been canceled within a given timeframe.
      Parameters:
      from - the time from which no deadline equal to the given deadline should be scheduled (inclusive)
      to - the time until which no deadline equal to the given deadline should be scheduled (inclusive)
      deadlineName - the name of the deadline which should not be scheduled
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectPublishedEventsMatching

      FixtureExecutionResult expectPublishedEventsMatching(org.hamcrest.Matcher<? extends List<? super EventMessage<?>>> matcher)
      Assert that the saga published events on the EventBus as defined by the given matcher. Only events published in the "when" stage of the tests are matched.
      Parameters:
      matcher - The matcher that defines the expected list of published events.
      Returns:
      the FixtureExecutionResult for method chaining
    • expectDeadlinesMetMatching

      @Deprecated FixtureExecutionResult expectDeadlinesMetMatching(org.hamcrest.Matcher<? extends List<? super DeadlineMessage<?>>> matcher)
      Asserts that deadlines match given matcher have been met (which have passed in time) on this saga.
      Parameters:
      matcher - The matcher that defines the expected list of deadlines
      Returns:
      the FixtureExecutionResult for method chaining
    • expectTriggeredDeadlinesMatching

      FixtureExecutionResult expectTriggeredDeadlinesMatching(org.hamcrest.Matcher<? extends List<? super DeadlineMessage<?>>> matcher)
      Asserts that deadlines matching the given matcher have been triggered for this aggregate.
      Parameters:
      matcher - the matcher that defines the expected list of deadlines
      Returns:
      the current FixtureExecutionResult for method chaining
    • expectPublishedEvents

      FixtureExecutionResult expectPublishedEvents(Object... expected)
      Assert that the saga published events on the EventBus in the exact sequence of the given expected events. Events are compared comparing their type and fields using equals. Sequence number and aggregate identifier (for domain events) are ignored in the comparison.
      Parameters:
      expected - The sequence of events expected to be published by the Saga
      Returns:
      the FixtureExecutionResult for method chaining
    • expectDeadlinesMet

      @Deprecated FixtureExecutionResult expectDeadlinesMet(Object... expected)
      Deprecated.
      Asserts that given expected deadlines have been met (which have passed in time). Deadlines are compared comparing their type and fields using "equals".
      Parameters:
      expected - The sequence of deadlines expected to be met
      Returns:
      the FixtureExecutionResult for method chaining
    • expectTriggeredDeadlines

      FixtureExecutionResult expectTriggeredDeadlines(Object... expected)
      Asserts that given expected deadlines have been triggered. Deadlines are compared comparing their type and fields using "equals".
      Parameters:
      expected - the sequence of deadlines expected to have been triggered
      Returns:
      the current FixtureExecutionResult for method chaining
    • expectTriggeredDeadlinesWithName

      FixtureExecutionResult expectTriggeredDeadlinesWithName(String... expectedDeadlineNames)
      Asserts that the given expectedDeadlineNames have been triggered. Matches that the given names are complete, in the same order and match the triggered deadlines by validating with DeadlineMessage.getDeadlineName().
      Parameters:
      expectedDeadlineNames - the sequence of deadline names expected to have been triggered
      Returns:
      the current FixtureExecutionResult for method chaining
    • expectTriggeredDeadlinesOfType

      FixtureExecutionResult expectTriggeredDeadlinesOfType(Class<?>... expectedDeadlineTypes)
      Asserts that the given expectedDeadlineTypes have been triggered. Matches that the given types are complete, in the same order and match the triggered deadlines by validating with Message.getPayloadType().
      Parameters:
      expectedDeadlineTypes - the sequence of deadline types expected to have been triggered
      Returns:
      the current FixtureExecutionResult for method chaining
    • expectSuccessfulHandlerExecution

      FixtureExecutionResult expectSuccessfulHandlerExecution()
      Expect a successful execution of the given event handler.
      Returns:
      the current FixtureExecutionResult, for fluent interfacing