Class ResultValidatorImpl<T>
- All Implemented Interfaces:
CommandCallback<Object,,Object> ResultValidator<T>
- Since:
- 0.7
- Author:
- Allard Buijze
-
Constructor Summary
ConstructorsConstructorDescriptionResultValidatorImpl(List<EventMessage<?>> publishedEvents, FieldFilter fieldFilter, Supplier<Aggregate<T>> aggregateState, StubDeadlineManager stubDeadlineManager) Initialize the ResultValidatorImpl with the givenstoredEventsandpublishedEvents. -
Method Summary
Modifier and TypeMethodDescriptionvoidMakes sure the execution phase has finishes without any Errors ir FixtureExecutionExceptions.expectDeadlinesMet(Object... expected) Asserts that givenexpecteddeadlines have been met (which have passed in time).expectDeadlinesMetMatching(org.hamcrest.Matcher<? extends List<? super DeadlineMessage<?>>> matcher) Asserts that deadlines matching the givenmatcherhave been met (which have passed in time) on this aggregate.expectEvents(Object... expectedEvents) Expect the given set of events to have been published.expectEvents(EventMessage<?>... expectedEvents) Expect the given set of events to have been published.expectEventsMatching(org.hamcrest.Matcher<? extends List<? super EventMessage<?>>> matcher) Expect the published events to match the givenmatcher.expectException(Class<? extends Throwable> expectedException) Expect the givenexpectedExceptionto occur during command handler execution.expectException(org.hamcrest.Matcher<?> matcher) Expect an exception to occur during command handler execution that matches with the givenmatcher.expectExceptionDetails(Class<?> exceptionDetails) Expect the givenexceptionDetailstype to occur during command handler execution.expectExceptionDetails(Object exceptionDetails) Expect the givenexceptionDetailsto occur during command handler execution.expectExceptionDetails(org.hamcrest.Matcher<?> exceptionDetailsMatcher) Expect exception details to occur during command handler execution that matches with the givenmatcher.expectExceptionMessage(String exceptionMessage) Expect the givenexceptionMessageto occur during command handler execution.expectExceptionMessage(org.hamcrest.Matcher<?> exceptionMessageMatcher) Expect an exception message to occur during command handler execution that matches with the givenmatcher.Asserts that the Aggregate has been marked for deletion.expectNoScheduledDeadline(Duration durationToScheduledTime, Object deadline) Asserts that no deadline equal to the givendeadlinehas been scheduled after the givendurationToScheduledTime.expectNoScheduledDeadline(Instant scheduledTime, Object deadline) Asserts that no deadline equal to the givendeadlinehas been scheduled at the givenscheduledTime.expectNoScheduledDeadline(Instant from, Instant to, Object deadline) Asserts that no deadline equal to the givendeadlinehas been scheduled between thetoandfromtimes, wheretoandfromare inclusive.expectNoScheduledDeadlineMatching(Duration durationToScheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher) Asserts that no deadline matching the givenmatchershould be scheduled after the givendurationToScheduledTime.expectNoScheduledDeadlineMatching(Instant from, Instant to, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher) Asserts that no deadline matching the givenmatcherhas been scheduled between thetoandfromtimes, wheretoandfromare inclusive.expectNoScheduledDeadlineMatching(Instant scheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher) Asserts that no deadline matching the givenmatcherhas been scheduled at the givenscheduledTime.expectNoScheduledDeadlineMatching(org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher) Asserts that no deadline matching the givenmatcheris scheduled.expectNoScheduledDeadlineOfType(Duration durationToScheduledTime, Class<?> deadlineType) Asserts that no deadline of the givendeadlineTypehas been scheduled after the givendurationToScheduledTime.expectNoScheduledDeadlineOfType(Instant scheduledTime, Class<?> deadlineType) Asserts that no deadline with the givendeadlineTypehas been scheduled at the givenscheduledTime.expectNoScheduledDeadlineOfType(Instant from, Instant to, Class<?> deadlineType) Asserts that no deadline with the givendeadlineTypehas been scheduled between thetoandfromtimes, wheretoandfromare inclusive.Asserts that no deadlines are scheduled.expectNoScheduledDeadlineWithName(Duration durationToScheduledTime, String deadlineName) Asserts that no deadline with the givendeadlineNamehas been scheduled after the givendurationToScheduledTime.expectNoScheduledDeadlineWithName(Instant scheduledTime, String deadlineName) Asserts that no deadline with the givendeadlineNamehas been scheduled at the givenscheduledTime.expectNoScheduledDeadlineWithName(Instant from, Instant to, String deadlineName) Asserts that no deadline with the givendeadlineNamehas been scheduled between thetoandfromtimes, wheretoandfromare inclusive.Asserts that the Aggregate has NOT been marked for deletion.expectResultMessage(CommandResultMessage<?> expectedResultMessage) Expect the command handler to return the givenexpectedResultMessageafter execution.expectResultMessageMatching(org.hamcrest.Matcher<? super CommandResultMessage<?>> matcher) Expect the command handler to return a value that matches the givenmatcherafter execution.expectResultMessagePayload(Object expectedPayload) Expect the command handler to return the givenexpectedPayloadafter execution.expectResultMessagePayloadMatching(org.hamcrest.Matcher<?> matcher) Expect the command handler to return a payload that matches the givenmatcherafter execution.expectScheduledDeadline(Duration duration, Object deadline) Asserts that a deadline equal to the givendeadlinehas been scheduled after the givenduration.expectScheduledDeadline(Instant scheduledTime, Object deadline) Asserts that a deadline equal to the givendeadlinehas been scheduled at the givenscheduledTime.expectScheduledDeadlineMatching(Duration duration, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher) Asserts that a deadline scheduled after givendurationmatches the givenmatcher.expectScheduledDeadlineMatching(Instant scheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher) Asserts that a deadline matching the givenmatcherhas been scheduled at the givenscheduledTime.expectScheduledDeadlineOfType(Duration duration, Class<?> deadlineType) Asserts that a deadline of the givendeadlineTypehas been scheduled after the givenduration.expectScheduledDeadlineOfType(Instant scheduledTime, Class<?> deadlineType) Asserts that a deadline of the givendeadlineTypehas been scheduled at the givenscheduledTime.expectScheduledDeadlineWithName(Duration duration, String deadlineName) Asserts that a deadline with the givendeadlineNamehas been scheduled after the givenduration.expectScheduledDeadlineWithName(Instant scheduledTime, String deadlineName) Asserts that a deadline with the givendeadlineNamehas been scheduled at the givenscheduledTime.expectState(Consumer<T> aggregateStateValidator) 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.Expect a successful execution of the given command handler, regardless of the actual return value.expectTriggeredDeadlines(Object... expected) Asserts that givenexpecteddeadlines have been triggered.expectTriggeredDeadlinesMatching(org.hamcrest.Matcher<? extends List<? super DeadlineMessage<?>>> matcher) Asserts that deadlines matching the givenmatcherhave been triggered for this aggregate.expectTriggeredDeadlinesOfType(Class<?>... expectedDeadlineTypes) Asserts that the givenexpectedDeadlineTypeshave been triggered.expectTriggeredDeadlinesWithName(String... expectedDeadlineNames) Asserts that the givenexpectedDeadlineNameshave been triggered.voidonResult(CommandMessage<?> commandMessage, CommandResultMessage<?> commandResultMessage) Invoked when command handling execution is completed.voidrecordException(Throwable exception) Record the givenexceptionas a result of this validator.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.commandhandling.CommandCallback
wrapMethods inherited from interface org.axonframework.test.aggregate.ResultValidator
expectNoEvents
-
Constructor Details
-
ResultValidatorImpl
public ResultValidatorImpl(List<EventMessage<?>> publishedEvents, FieldFilter fieldFilter, Supplier<Aggregate<T>> aggregateState, StubDeadlineManager stubDeadlineManager) Initialize the ResultValidatorImpl with the givenstoredEventsandpublishedEvents.- Parameters:
publishedEvents- The events that were published during command executionfieldFilter- The filter describing which fields to include in the comparison
-
-
Method Details
-
expectEvents
Description copied from interface:ResultValidatorExpect 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:
expectEventsin interfaceResultValidator<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
Description copied from interface:ResultValidatorExpect 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:
expectEventsin interfaceResultValidator<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:ResultValidatorExpect the published events to match the givenmatcher.Note: if no events were published, the matcher receives an empty List.
- Specified by:
expectEventsMatchingin interfaceResultValidator<T>- Parameters:
matcher- The matcher to match with the actually published events- Returns:
- the current ResultValidator, for fluent interfacing
-
expectSuccessfulHandlerExecution
Description copied from interface:ResultValidatorExpect a successful execution of the given command handler, regardless of the actual return value.- Specified by:
expectSuccessfulHandlerExecutionin interfaceResultValidator<T>- Returns:
- the current ResultValidator, for fluent interfacing
-
expectState
Description copied from interface:ResultValidatorProvides 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:
expectStatein interfaceResultValidator<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:ResultValidatorAsserts that a deadline scheduled after givendurationmatches the givenmatcher.- Specified by:
expectScheduledDeadlineMatchingin interfaceResultValidator<T>- Parameters:
duration- the delay expected before the deadline is metmatcher- the matcher that must match with the deadline scheduled at the given time- Returns:
- the current ResultValidator, for fluent interfacing
-
expectScheduledDeadline
Description copied from interface:ResultValidatorAsserts that a deadline equal to the givendeadlinehas been scheduled after the givenduration. 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:
expectScheduledDeadlinein interfaceResultValidator<T>- Parameters:
duration- the time to wait before the deadline should be metdeadline- the expected deadline- Returns:
- the current ResultValidator, for fluent interfacing
-
expectScheduledDeadlineOfType
Description copied from interface:ResultValidatorAsserts that a deadline of the givendeadlineTypehas been scheduled after the givenduration.- Specified by:
expectScheduledDeadlineOfTypein interfaceResultValidator<T>- Parameters:
duration- the time to wait before the deadline is metdeadlineType- the type of the expected deadline- Returns:
- the current ResultValidator, for fluent interfacing
-
expectScheduledDeadlineWithName
Description copied from interface:ResultValidatorAsserts that a deadline with the givendeadlineNamehas been scheduled after the givenduration.- Specified by:
expectScheduledDeadlineWithNamein interfaceResultValidator<T>- Parameters:
duration- the time to wait before the deadline is metdeadlineName- 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:ResultValidatorAsserts that a deadline matching the givenmatcherhas been scheduled at the givenscheduledTime. If thescheduledTimeis calculated based on the "current time", use theTestExecutor.currentTime()to get the time to use as "current time".- Specified by:
expectScheduledDeadlineMatchingin interfaceResultValidator<T>- Parameters:
scheduledTime- the time at which the deadline should be metmatcher- the matcher defining the deadline expected- Returns:
- the current ResultValidator, for fluent interfacing
-
expectScheduledDeadline
Description copied from interface:ResultValidatorAsserts that a deadline equal to the givendeadlinehas been scheduled at the givenscheduledTime. If thescheduledTimeis calculated based on the "current time", use theTestExecutor.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:
expectScheduledDeadlinein interfaceResultValidator<T>- Parameters:
scheduledTime- the time at which the deadline is scheduleddeadline- the expected deadline- Returns:
- the current ResultValidator, for fluent interfacing
-
expectScheduledDeadlineOfType
public ResultValidator<T> expectScheduledDeadlineOfType(Instant scheduledTime, Class<?> deadlineType) Description copied from interface:ResultValidatorAsserts that a deadline of the givendeadlineTypehas been scheduled at the givenscheduledTime.- Specified by:
expectScheduledDeadlineOfTypein interfaceResultValidator<T>- Parameters:
scheduledTime- the time at which the deadline is scheduleddeadlineType- 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:ResultValidatorAsserts that a deadline with the givendeadlineNamehas been scheduled at the givenscheduledTime.- Specified by:
expectScheduledDeadlineWithNamein interfaceResultValidator<T>- Parameters:
scheduledTime- the time at which the deadline is scheduleddeadlineName- the name of the expected deadline- Returns:
- the current ResultValidator, for fluent interfacing
-
expectNoScheduledDeadlines
Description copied from interface:ResultValidatorAsserts 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:
expectNoScheduledDeadlinesin interfaceResultValidator<T>- Returns:
- the current ResultValidator, for fluent interfacing
-
expectNoScheduledDeadlineMatching
public ResultValidator<T> expectNoScheduledDeadlineMatching(org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher) Description copied from interface:ResultValidatorAsserts that no deadline matching the givenmatcheris scheduled. Can be used to validate if a deadline has never been set or has been canceled.- Specified by:
expectNoScheduledDeadlineMatchingin interfaceResultValidator<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:ResultValidatorAsserts that no deadline matching the givenmatchershould be scheduled after the givendurationToScheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time.- Specified by:
expectNoScheduledDeadlineMatchingin interfaceResultValidator<T>- Parameters:
durationToScheduledTime- the time to wait until the trigger point of the deadline which should not be scheduledmatcher- 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:ResultValidatorAsserts that no deadline equal to the givendeadlinehas been scheduled after the givendurationToScheduledTime. 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:
expectNoScheduledDeadlinein interfaceResultValidator<T>- Parameters:
durationToScheduledTime- the time to wait until the trigger point of the deadline which should not be scheduleddeadline- 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:ResultValidatorAsserts that no deadline of the givendeadlineTypehas been scheduled after the givendurationToScheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time.- Specified by:
expectNoScheduledDeadlineOfTypein interfaceResultValidator<T>- Parameters:
durationToScheduledTime- the time to wait until the trigger point of the deadline which should not be scheduleddeadlineType- 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:ResultValidatorAsserts that no deadline with the givendeadlineNamehas been scheduled after the givendurationToScheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time.- Specified by:
expectNoScheduledDeadlineWithNamein interfaceResultValidator<T>- Parameters:
durationToScheduledTime- the time to wait until the trigger point of the deadline which should not be scheduleddeadlineName- 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:ResultValidatorAsserts that no deadline matching the givenmatcherhas been scheduled at the givenscheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time. If thescheduledTimeis calculated based on the "current time", use theTestExecutor.currentTime()to get the time to use as "current time".- Specified by:
expectNoScheduledDeadlineMatchingin interfaceResultValidator<T>- Parameters:
scheduledTime- the time at which no deadline matching the givenmatchershould be scheduledmatcher- the matcher defining the deadline which should not be scheduled- Returns:
- the current ResultValidator, for fluent interfacing
-
expectNoScheduledDeadline
Description copied from interface:ResultValidatorAsserts that no deadline equal to the givendeadlinehas been scheduled at the givenscheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time. If thescheduledTimeis calculated based on the "current time", use theTestExecutor.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:
expectNoScheduledDeadlinein interfaceResultValidator<T>- Parameters:
scheduledTime- the time at which no deadline equal to the givendeadlineshould be scheduleddeadline- 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:ResultValidatorAsserts that no deadline with the givendeadlineTypehas been scheduled at the givenscheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time.- Specified by:
expectNoScheduledDeadlineOfTypein interfaceResultValidator<T>- Parameters:
scheduledTime- the time at which no deadline ofdeadlineTypeshould be scheduleddeadlineType- 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:ResultValidatorAsserts that no deadline with the givendeadlineNamehas been scheduled at the givenscheduledTime. Can be used to validate if a deadline has never been set or has been canceled at an exact moment in time.- Specified by:
expectNoScheduledDeadlineWithNamein interfaceResultValidator<T>- Parameters:
scheduledTime- the time at which no deadline ofdeadlineNameshould be scheduleddeadlineName- 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:ResultValidatorAsserts that no deadline matching the givenmatcherhas been scheduled between thetoandfromtimes, wheretoandfromare inclusive. Can be used to validate if a deadline has never been set or has been canceled within a given timeframe.- Specified by:
expectNoScheduledDeadlineMatchingin interfaceResultValidator<T>- Parameters:
from- the time from which no deadline equal to the givendeadlineshould be scheduled (inclusive)to- the time until which no deadline equal to the givendeadlineshould be scheduled (inclusive)matcher- the matcher defining the deadline which should not be scheduled- Returns:
- the current ResultValidator, for fluent interfacing
-
expectNoScheduledDeadline
Description copied from interface:ResultValidatorAsserts that no deadline equal to the givendeadlinehas been scheduled between thetoandfromtimes, wheretoandfromare inclusive. Can be used to validate if a deadline has never been set or has been canceled within a given timeframe.- Specified by:
expectNoScheduledDeadlinein interfaceResultValidator<T>- Parameters:
from- the time from which no deadline equal to the givendeadlineshould be scheduled (inclusive)to- the time until which no deadline equal to the givendeadlineshould 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:ResultValidatorAsserts that no deadline with the givendeadlineTypehas been scheduled between thetoandfromtimes, wheretoandfromare inclusive. Can be used to validate if a deadline has never been set or has been canceled within a given timeframe.- Specified by:
expectNoScheduledDeadlineOfTypein interfaceResultValidator<T>- Parameters:
from- the time from which no deadline equal to the givendeadlineshould be scheduled (inclusive)to- the time until which no deadline equal to the givendeadlineshould 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:ResultValidatorAsserts that no deadline with the givendeadlineNamehas been scheduled between thetoandfromtimes, wheretoandfromare inclusive. Can be used to validate if a deadline has never been set or has been canceled within a given timeframe.- Specified by:
expectNoScheduledDeadlineWithNamein interfaceResultValidator<T>- Parameters:
from- the time from which no deadline equal to the givendeadlineshould be scheduled (inclusive)to- the time until which no deadline equal to the givendeadlineshould 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:ResultValidatorAsserts that deadlines matching the givenmatcherhave been met (which have passed in time) on this aggregate.- Specified by:
expectDeadlinesMetMatchingin interfaceResultValidator<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:ResultValidatorAsserts that deadlines matching the givenmatcherhave been triggered for this aggregate.- Specified by:
expectTriggeredDeadlinesMatchingin interfaceResultValidator<T>- Parameters:
matcher- the matcher that defines the expected list of deadlines- Returns:
- the current ResultValidator, for fluent interfacing
-
expectDeadlinesMet
Description copied from interface:ResultValidatorAsserts that givenexpecteddeadlines have been met (which have passed in time). Deadlines are compared comparing their type and fields using "equals".- Specified by:
expectDeadlinesMetin interfaceResultValidator<T>- Parameters:
expected- The sequence of deadlines expected to be met- Returns:
- the current ResultValidator, for fluent interfacing
-
expectTriggeredDeadlines
Description copied from interface:ResultValidatorAsserts that givenexpecteddeadlines have been triggered. Deadlines are compared by their type and fields using "equals".- Specified by:
expectTriggeredDeadlinesin interfaceResultValidator<T>- Parameters:
expected- the sequence of deadlines expected to have been triggered- Returns:
- the current ResultValidator, for fluent interfacing
-
expectTriggeredDeadlinesWithName
Description copied from interface:ResultValidatorAsserts that the givenexpectedDeadlineNameshave been triggered. Matches that the given names are complete, in the same order and match the triggered deadlines by validating withDeadlineMessage.getDeadlineName().- Specified by:
expectTriggeredDeadlinesWithNamein interfaceResultValidator<T>- Parameters:
expectedDeadlineNames- the sequence of deadline names expected to have been triggered- Returns:
- the current ResultValidator, for fluent interfacing
-
expectTriggeredDeadlinesOfType
Description copied from interface:ResultValidatorAsserts that the givenexpectedDeadlineTypeshave been triggered. Matches that the given types are complete, in the same order and match the triggered deadlines by validating withMessage.getPayloadType().- Specified by:
expectTriggeredDeadlinesOfTypein interfaceResultValidator<T>- Parameters:
expectedDeadlineTypes- the sequence of deadline types expected to have been triggered- Returns:
- the current ResultValidator, for fluent interfacing
-
expectResultMessagePayload
Description copied from interface:ResultValidatorExpect the command handler to return the givenexpectedPayloadafter execution. The actual and expected values are compared using their equals methods.- Specified by:
expectResultMessagePayloadin interfaceResultValidator<T>- Parameters:
expectedPayload- The expected result message payload of the command execution- Returns:
- the current ResultValidator, for fluent interfacing
-
expectResultMessagePayloadMatching
Description copied from interface:ResultValidatorExpect the command handler to return a payload that matches the givenmatcherafter execution.- Specified by:
expectResultMessagePayloadMatchingin interfaceResultValidator<T>- Parameters:
matcher- The matcher to verify the actual return value against- Returns:
- the current ResultValidator, for fluent interfacing
-
expectResultMessage
Description copied from interface:ResultValidatorExpect the command handler to return the givenexpectedResultMessageafter execution. The actual and expected values are compared using their equals methods.Comparison is done on message payload and meta data.
- Specified by:
expectResultMessagein interfaceResultValidator<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:ResultValidatorExpect the command handler to return a value that matches the givenmatcherafter execution.- Specified by:
expectResultMessageMatchingin interfaceResultValidator<T>- Parameters:
matcher- The matcher to verify the actual result message against- Returns:
- the current ResultValidator, for fluent interfacing
-
expectExceptionMessage
Description copied from interface:ResultValidatorExpect an exception message to occur during command handler execution that matches with the givenmatcher.- Specified by:
expectExceptionMessagein interfaceResultValidator<T>- Parameters:
exceptionMessageMatcher- The matcher to validate the actual exception message- Returns:
- the current ResultValidator, for fluent interfacing
-
expectExceptionMessage
Description copied from interface:ResultValidatorExpect the givenexceptionMessageto occur during command handler execution. The actual exception message should be exactly the same asexceptionMessage.- Specified by:
expectExceptionMessagein interfaceResultValidator<T>- Parameters:
exceptionMessage- The exception message expected from the command handler execution- Returns:
- the current ResultValidator, for fluent interfacing
-
expectException
Description copied from interface:ResultValidatorExpect the givenexpectedExceptionto occur during command handler execution. The actual exception should be exactly of that type, subclasses are not accepted.- Specified by:
expectExceptionin interfaceResultValidator<T>- Parameters:
expectedException- The type of exception expected from the command handler execution- Returns:
- the current ResultValidator, for fluent interfacing
-
expectException
Description copied from interface:ResultValidatorExpect an exception to occur during command handler execution that matches with the givenmatcher.- Specified by:
expectExceptionin interfaceResultValidator<T>- Parameters:
matcher- The matcher to validate the actual exception- Returns:
- the current ResultValidator, for fluent interfacing
-
expectExceptionDetails
Description copied from interface:ResultValidatorExpect the givenexceptionDetailsto occur during command handler execution. The actual exception details should be exactly the same asexceptionDetails.- Specified by:
expectExceptionDetailsin interfaceResultValidator<T>- Parameters:
exceptionDetails- The exception details expected from the command handler execution- Returns:
- the current ResultValidator, for fluent interfacing
-
expectExceptionDetails
Description copied from interface:ResultValidatorExpect the givenexceptionDetailstype to occur during command handler execution. The actual exception details should be exactly of that type, subclasses are not accepted.- Specified by:
expectExceptionDetailsin interfaceResultValidator<T>- Parameters:
exceptionDetails- The type of exception details expected from the command handler execution- Returns:
- the current ResultValidator, for fluent interfacing
-
expectExceptionDetails
Description copied from interface:ResultValidatorExpect exception details to occur during command handler execution that matches with the givenmatcher.- Specified by:
expectExceptionDetailsin interfaceResultValidator<T>- Parameters:
exceptionDetailsMatcher- The matcher to validate the actual exception details- Returns:
- the current ResultValidator, for fluent interfacing
-
expectMarkedDeleted
Description copied from interface:ResultValidatorAsserts that the Aggregate has been marked for deletion.- Specified by:
expectMarkedDeletedin interfaceResultValidator<T>- Returns:
- the current ResultValidator, for fluent interfacing
-
expectNotMarkedDeleted
Description copied from interface:ResultValidatorAsserts that the Aggregate has NOT been marked for deletion.- Specified by:
expectNotMarkedDeletedin interfaceResultValidator<T>- Returns:
- the current ResultValidator, for fluent interfacing
-
onResult
public void onResult(@Nonnull CommandMessage<?> commandMessage, @Nonnull CommandResultMessage<?> commandResultMessage) Description copied from interface:CommandCallbackInvoked when command handling execution is completed.- Specified by:
onResultin interfaceCommandCallback<Object,Object> - Parameters:
commandMessage- theCommandMessagethat was dispatchedcommandResultMessage- theCommandResultMessageof the command handling execution
-
recordException
Record the givenexceptionas 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.
-