Class ResultValidatorImpl<T>

java.lang.Object
org.axonframework.test.aggregate.ResultValidatorImpl<T>
All Implemented Interfaces:
CommandCallback<Object,Object>, ResultValidator<T>

public class ResultValidatorImpl<T> extends Object implements ResultValidator<T>, CommandCallback<Object,Object>
Implementation of the ResultValidator. It also acts as a CommandCallback, and registers the actual result.
Since:
0.7
Author:
Allard Buijze
  • Constructor Details

    • ResultValidatorImpl

      public ResultValidatorImpl(List<EventMessage<?>> publishedEvents, FieldFilter fieldFilter, Supplier<Aggregate<T>> aggregateState, StubDeadlineManager stubDeadlineManager)
      Initialize the ResultValidatorImpl with the given storedEvents and publishedEvents.
      Parameters:
      publishedEvents - The events that were published during command execution
      fieldFilter - The filter describing which fields to include in the comparison
  • Method Details

    • expectEvents

      public ResultValidator<T> expectEvents(Object... expectedEvents)
      Description copied from interface: ResultValidator
      Expect the given set of events to have been published.

      All events are compared for equality using a shallow equals comparison on all the fields of the events. This means that all assigned values on the events' fields should have a proper equals implementation.

      Note that the event identifier is ignored in the comparison.

      Specified by:
      expectEvents in interface ResultValidator<T>
      Parameters:
      expectedEvents - The expected events, in the exact order they are expected to be dispatched and stored.
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectEvents

      public ResultValidator<T> expectEvents(EventMessage<?>... expectedEvents)
      Description copied from interface: ResultValidator
      Expect the given set of events to have been published.

      All events are compared for equality using a shallow equals comparison on all the fields of the events. This means that all assigned values on the events' fields should have a proper equals implementation.
      Additionally the metadata will be compared too.

      Note that the event identifier is ignored in the comparison.

      Specified by:
      expectEvents in interface ResultValidator<T>
      Parameters:
      expectedEvents - The expected events, in the exact order they are expected to be dispatched and stored.
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectEventsMatching

      public ResultValidator<T> expectEventsMatching(org.hamcrest.Matcher<? extends List<? super EventMessage<?>>> matcher)
      Description copied from interface: ResultValidator
      Expect the published events to match the given matcher.

      Note: if no events were published, the matcher receives an empty List.

      Specified by:
      expectEventsMatching in interface ResultValidator<T>
      Parameters:
      matcher - The matcher to match with the actually published events
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectSuccessfulHandlerExecution

      public ResultValidator<T> expectSuccessfulHandlerExecution()
      Description copied from interface: ResultValidator
      Expect a successful execution of the given command handler, regardless of the actual return value.
      Specified by:
      expectSuccessfulHandlerExecution in interface ResultValidator<T>
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectState

      public ResultValidator<T> expectState(Consumer<T> aggregateStateValidator)
      Description copied from interface: ResultValidator
      Provides access the the state of the Aggregate as it was stored in the repository, allowing for validation of the state of the aggregate, as it was left in the repository.

      Note that validating state on Event Sourced Aggregate is highly discouraged. Event Sourced aggregates should measure behavior exclusively by measuring emitted events.

      Specified by:
      expectState in interface ResultValidator<T>
      Parameters:
      aggregateStateValidator - a consumer that is provided with the aggregate instance, allowing it to make assertions based on the aggregate's state.
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectScheduledDeadlineMatching

      public ResultValidator<T> expectScheduledDeadlineMatching(Duration duration, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
      Description copied from interface: ResultValidator
      Asserts that a deadline scheduled after given duration matches the given matcher.
      Specified by:
      expectScheduledDeadlineMatching in interface ResultValidator<T>
      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 current ResultValidator, for fluent interfacing
    • expectScheduledDeadline

      public ResultValidator<T> expectScheduledDeadline(Duration duration, Object deadline)
      Description copied from interface: ResultValidator
      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.

      Specified by:
      expectScheduledDeadline in interface ResultValidator<T>
      Parameters:
      duration - the time to wait before the deadline should be met
      deadline - the expected deadline
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectScheduledDeadlineOfType

      public ResultValidator<T> expectScheduledDeadlineOfType(Duration duration, Class<?> deadlineType)
      Description copied from interface: ResultValidator
      Asserts that a deadline of the given deadlineType has been scheduled after the given duration.
      Specified by:
      expectScheduledDeadlineOfType in interface ResultValidator<T>
      Parameters:
      duration - the time to wait before the deadline is met
      deadlineType - the type of the expected deadline
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectScheduledDeadlineWithName

      public ResultValidator<T> expectScheduledDeadlineWithName(Duration duration, String deadlineName)
      Description copied from interface: ResultValidator
      Asserts that a deadline with the given deadlineName has been scheduled after the given duration.
      Specified by:
      expectScheduledDeadlineWithName in interface ResultValidator<T>
      Parameters:
      duration - the time to wait before the deadline is met
      deadlineName - the name of the expected deadline
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectScheduledDeadlineMatching

      public ResultValidator<T> expectScheduledDeadlineMatching(Instant scheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
      Description copied from interface: ResultValidator
      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 TestExecutor.currentTime() to get the time to use as "current time".

      Specified by:
      expectScheduledDeadlineMatching in interface ResultValidator<T>
      Parameters:
      scheduledTime - the time at which the deadline should be met
      matcher - the matcher defining the deadline expected
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectScheduledDeadline

      public ResultValidator<T> expectScheduledDeadline(Instant scheduledTime, Object deadline)
      Description copied from interface: ResultValidator
      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 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.

      Specified by:
      expectScheduledDeadline in interface ResultValidator<T>
      Parameters:
      scheduledTime - the time at which the deadline is scheduled
      deadline - the expected deadline
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectScheduledDeadlineOfType

      public ResultValidator<T> expectScheduledDeadlineOfType(Instant scheduledTime, Class<?> deadlineType)
      Description copied from interface: ResultValidator
      Asserts that a deadline of the given deadlineType has been scheduled at the given scheduledTime.
      Specified by:
      expectScheduledDeadlineOfType in interface ResultValidator<T>
      Parameters:
      scheduledTime - the time at which the deadline is scheduled
      deadlineType - the type of the expected deadline
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectScheduledDeadlineWithName

      public ResultValidator<T> expectScheduledDeadlineWithName(Instant scheduledTime, String deadlineName)
      Description copied from interface: ResultValidator
      Asserts that a deadline with the given deadlineName has been scheduled at the given scheduledTime.
      Specified by:
      expectScheduledDeadlineWithName in interface ResultValidator<T>
      Parameters:
      scheduledTime - the time at which the deadline is scheduled
      deadlineName - the name of the expected deadline
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadlines

      public ResultValidator<T> expectNoScheduledDeadlines()
      Description copied from interface: ResultValidator
      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.
      Specified by:
      expectNoScheduledDeadlines in interface ResultValidator<T>
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadlineMatching

      public ResultValidator<T> expectNoScheduledDeadlineMatching(org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
      Description copied from interface: ResultValidator
      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.
      Specified by:
      expectNoScheduledDeadlineMatching in interface ResultValidator<T>
      Parameters:
      matcher - the matcher defining the deadline which should not be scheduled
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadlineMatching

      public ResultValidator<T> expectNoScheduledDeadlineMatching(Duration durationToScheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
      Description copied from interface: ResultValidator
      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.
      Specified by:
      expectNoScheduledDeadlineMatching in interface ResultValidator<T>
      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 current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadline

      public ResultValidator<T> expectNoScheduledDeadline(Duration durationToScheduledTime, Object deadline)
      Description copied from interface: ResultValidator
      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.

      Specified by:
      expectNoScheduledDeadline in interface ResultValidator<T>
      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 current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadlineOfType

      public ResultValidator<T> expectNoScheduledDeadlineOfType(Duration durationToScheduledTime, Class<?> deadlineType)
      Description copied from interface: ResultValidator
      Asserts that no deadline of the given deadlineType 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.
      Specified by:
      expectNoScheduledDeadlineOfType in interface ResultValidator<T>
      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 current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadlineWithName

      public ResultValidator<T> expectNoScheduledDeadlineWithName(Duration durationToScheduledTime, String deadlineName)
      Description copied from interface: ResultValidator
      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.
      Specified by:
      expectNoScheduledDeadlineWithName in interface ResultValidator<T>
      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 current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadlineMatching

      public ResultValidator<T> expectNoScheduledDeadlineMatching(Instant scheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
      Description copied from interface: ResultValidator
      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".

      Specified by:
      expectNoScheduledDeadlineMatching in interface ResultValidator<T>
      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 current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadline

      public ResultValidator<T> expectNoScheduledDeadline(Instant scheduledTime, Object deadline)
      Description copied from interface: ResultValidator
      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.

      Specified by:
      expectNoScheduledDeadline in interface ResultValidator<T>
      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 current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadlineOfType

      public ResultValidator<T> expectNoScheduledDeadlineOfType(Instant scheduledTime, Class<?> deadlineType)
      Description copied from interface: ResultValidator
      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.
      Specified by:
      expectNoScheduledDeadlineOfType in interface ResultValidator<T>
      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 current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadlineWithName

      public ResultValidator<T> expectNoScheduledDeadlineWithName(Instant scheduledTime, String deadlineName)
      Description copied from interface: ResultValidator
      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.
      Specified by:
      expectNoScheduledDeadlineWithName in interface ResultValidator<T>
      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 current ResultValidator, for fluent interfacing
    • expectNoScheduledDeadlineMatching

      public ResultValidator<T> expectNoScheduledDeadlineMatching(Instant from, Instant to, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
      Description copied from interface: ResultValidator
      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.
      Specified by:
      expectNoScheduledDeadlineMatching in interface ResultValidator<T>
      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

      public ResultValidator<T> expectNoScheduledDeadline(Instant from, Instant to, Object deadline)
      Description copied from interface: ResultValidator
      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.
      Specified by:
      expectNoScheduledDeadline in interface ResultValidator<T>
      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

      public ResultValidator<T> expectNoScheduledDeadlineOfType(Instant from, Instant to, Class<?> deadlineType)
      Description copied from interface: ResultValidator
      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.
      Specified by:
      expectNoScheduledDeadlineOfType in interface ResultValidator<T>
      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

      public ResultValidator<T> expectNoScheduledDeadlineWithName(Instant from, Instant to, String deadlineName)
      Description copied from interface: ResultValidator
      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.
      Specified by:
      expectNoScheduledDeadlineWithName in interface ResultValidator<T>
      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
    • expectDeadlinesMetMatching

      public ResultValidator<T> expectDeadlinesMetMatching(org.hamcrest.Matcher<? extends List<? super DeadlineMessage<?>>> matcher)
      Description copied from interface: ResultValidator
      Asserts that deadlines matching the given matcher have been met (which have passed in time) on this aggregate.
      Specified by:
      expectDeadlinesMetMatching in interface ResultValidator<T>
      Parameters:
      matcher - The matcher that defines the expected list of deadlines
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectTriggeredDeadlinesMatching

      public ResultValidator<T> expectTriggeredDeadlinesMatching(org.hamcrest.Matcher<? extends List<? super DeadlineMessage<?>>> matcher)
      Description copied from interface: ResultValidator
      Asserts that deadlines matching the given matcher have been triggered for this aggregate.
      Specified by:
      expectTriggeredDeadlinesMatching in interface ResultValidator<T>
      Parameters:
      matcher - the matcher that defines the expected list of deadlines
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectDeadlinesMet

      public ResultValidator<T> expectDeadlinesMet(Object... expected)
      Description copied from interface: ResultValidator
      Asserts that given expected deadlines have been met (which have passed in time). Deadlines are compared comparing their type and fields using "equals".
      Specified by:
      expectDeadlinesMet in interface ResultValidator<T>
      Parameters:
      expected - The sequence of deadlines expected to be met
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectTriggeredDeadlines

      public ResultValidator<T> expectTriggeredDeadlines(Object... expected)
      Description copied from interface: ResultValidator
      Asserts that given expected deadlines have been triggered. Deadlines are compared by their type and fields using "equals".
      Specified by:
      expectTriggeredDeadlines in interface ResultValidator<T>
      Parameters:
      expected - the sequence of deadlines expected to have been triggered
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectTriggeredDeadlinesWithName

      public ResultValidator<T> expectTriggeredDeadlinesWithName(String... expectedDeadlineNames)
      Description copied from interface: ResultValidator
      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().
      Specified by:
      expectTriggeredDeadlinesWithName in interface ResultValidator<T>
      Parameters:
      expectedDeadlineNames - the sequence of deadline names expected to have been triggered
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectTriggeredDeadlinesOfType

      public ResultValidator<T> expectTriggeredDeadlinesOfType(Class<?>... expectedDeadlineTypes)
      Description copied from interface: ResultValidator
      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().
      Specified by:
      expectTriggeredDeadlinesOfType in interface ResultValidator<T>
      Parameters:
      expectedDeadlineTypes - the sequence of deadline types expected to have been triggered
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectResultMessagePayload

      public ResultValidator<T> expectResultMessagePayload(Object expectedPayload)
      Description copied from interface: ResultValidator
      Expect the command handler to return the given expectedPayload after execution. The actual and expected values are compared using their equals methods.
      Specified by:
      expectResultMessagePayload in interface ResultValidator<T>
      Parameters:
      expectedPayload - The expected result message payload of the command execution
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectResultMessagePayloadMatching

      public ResultValidator<T> expectResultMessagePayloadMatching(org.hamcrest.Matcher<?> matcher)
      Description copied from interface: ResultValidator
      Expect the command handler to return a payload that matches the given matcher after execution.
      Specified by:
      expectResultMessagePayloadMatching in interface ResultValidator<T>
      Parameters:
      matcher - The matcher to verify the actual return value against
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectResultMessage

      public ResultValidator<T> expectResultMessage(CommandResultMessage<?> expectedResultMessage)
      Description copied from interface: ResultValidator
      Expect the command handler to return the given expectedResultMessage after execution. The actual and expected values are compared using their equals methods.

      Comparison is done on message payload and meta data.

      Specified by:
      expectResultMessage in interface ResultValidator<T>
      Parameters:
      expectedResultMessage - The expected result message of the command execution
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectResultMessageMatching

      public ResultValidator<T> expectResultMessageMatching(org.hamcrest.Matcher<? super CommandResultMessage<?>> matcher)
      Description copied from interface: ResultValidator
      Expect the command handler to return a value that matches the given matcher after execution.
      Specified by:
      expectResultMessageMatching in interface ResultValidator<T>
      Parameters:
      matcher - The matcher to verify the actual result message against
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectExceptionMessage

      public ResultValidator<T> expectExceptionMessage(org.hamcrest.Matcher<?> exceptionMessageMatcher)
      Description copied from interface: ResultValidator
      Expect an exception message to occur during command handler execution that matches with the given matcher.
      Specified by:
      expectExceptionMessage in interface ResultValidator<T>
      Parameters:
      exceptionMessageMatcher - The matcher to validate the actual exception message
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectExceptionMessage

      public ResultValidator<T> expectExceptionMessage(String exceptionMessage)
      Description copied from interface: ResultValidator
      Expect the given exceptionMessage to occur during command handler execution. The actual exception message should be exactly the same as exceptionMessage.
      Specified by:
      expectExceptionMessage in interface ResultValidator<T>
      Parameters:
      exceptionMessage - The exception message expected from the command handler execution
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectException

      public ResultValidator<T> expectException(Class<? extends Throwable> expectedException)
      Description copied from interface: ResultValidator
      Expect the given expectedException to occur during command handler execution. The actual exception should be exactly of that type, subclasses are not accepted.
      Specified by:
      expectException in interface ResultValidator<T>
      Parameters:
      expectedException - The type of exception expected from the command handler execution
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectException

      public ResultValidator<T> expectException(org.hamcrest.Matcher<?> matcher)
      Description copied from interface: ResultValidator
      Expect an exception to occur during command handler execution that matches with the given matcher.
      Specified by:
      expectException in interface ResultValidator<T>
      Parameters:
      matcher - The matcher to validate the actual exception
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectExceptionDetails

      public ResultValidator<T> expectExceptionDetails(Object exceptionDetails)
      Description copied from interface: ResultValidator
      Expect the given exceptionDetails to occur during command handler execution. The actual exception details should be exactly the same as exceptionDetails.
      Specified by:
      expectExceptionDetails in interface ResultValidator<T>
      Parameters:
      exceptionDetails - The exception details expected from the command handler execution
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectExceptionDetails

      public ResultValidator<T> expectExceptionDetails(Class<?> exceptionDetails)
      Description copied from interface: ResultValidator
      Expect the given exceptionDetails type to occur during command handler execution. The actual exception details should be exactly of that type, subclasses are not accepted.
      Specified by:
      expectExceptionDetails in interface ResultValidator<T>
      Parameters:
      exceptionDetails - The type of exception details expected from the command handler execution
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectExceptionDetails

      public ResultValidator<T> expectExceptionDetails(org.hamcrest.Matcher<?> exceptionDetailsMatcher)
      Description copied from interface: ResultValidator
      Expect exception details to occur during command handler execution that matches with the given matcher.
      Specified by:
      expectExceptionDetails in interface ResultValidator<T>
      Parameters:
      exceptionDetailsMatcher - The matcher to validate the actual exception details
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectMarkedDeleted

      public ResultValidator<T> expectMarkedDeleted()
      Description copied from interface: ResultValidator
      Asserts that the Aggregate has been marked for deletion.
      Specified by:
      expectMarkedDeleted in interface ResultValidator<T>
      Returns:
      the current ResultValidator, for fluent interfacing
    • expectNotMarkedDeleted

      public ResultValidator<T> expectNotMarkedDeleted()
      Description copied from interface: ResultValidator
      Asserts that the Aggregate has NOT been marked for deletion.
      Specified by:
      expectNotMarkedDeleted in interface ResultValidator<T>
      Returns:
      the current ResultValidator, for fluent interfacing
    • onResult

      public void onResult(@Nonnull CommandMessage<?> commandMessage, @Nonnull CommandResultMessage<?> commandResultMessage)
      Description copied from interface: CommandCallback
      Invoked when command handling execution is completed.
      Specified by:
      onResult in interface CommandCallback<Object,Object>
      Parameters:
      commandMessage - the CommandMessage that was dispatched
      commandResultMessage - the CommandResultMessage of the command handling execution
    • recordException

      public void recordException(Throwable exception)
      Record the given exception as a result of this validator.
      Parameters:
      exception - The exception to record as a result of this validator.
    • assertValidRecording

      public void assertValidRecording()
      Makes sure the execution phase has finishes without any Errors ir FixtureExecutionExceptions. If an error was recorded, it will be thrown immediately. This allows one to distinguish between failed tests, and tests in error.