public class ResultValidatorImpl<T> extends Object implements ResultValidator<T>, CommandCallback<Object,Object>
Constructor and Description |
---|
ResultValidatorImpl(List<EventMessage<?>> publishedEvents,
FieldFilter fieldFilter,
Supplier<Aggregate<T>> aggregateState,
StubDeadlineManager stubDeadlineManager)
Initialize the ResultValidatorImpl with the given
storedEvents and publishedEvents . |
Modifier and Type | Method and Description |
---|---|
void |
assertValidRecording()
Makes sure the execution phase has finishes without any Errors ir FixtureExecutionExceptions.
|
ResultValidator<T> |
expectDeadlinesMet(Object... expected)
Asserts that given
expected deadlines have been met (which have passed in time). |
ResultValidator<T> |
expectDeadlinesMetMatching(org.hamcrest.Matcher<? extends List<? super DeadlineMessage<?>>> matcher)
Asserts that deadlines matching the given
matcher have been met (which have passed in time) on this aggregate. |
ResultValidator<T> |
expectEvents(EventMessage<?>... expectedEvents)
Expect the given set of events to have been published.
|
ResultValidator<T> |
expectEvents(Object... expectedEvents)
Expect the given set of events to have been published.
|
ResultValidator<T> |
expectEventsMatching(org.hamcrest.Matcher<? extends List<? super EventMessage<?>>> matcher)
Expect the published events to match the given
matcher . |
ResultValidator<T> |
expectException(Class<? extends Throwable> expectedException)
Expect the given
expectedException to occur during command handler execution. |
ResultValidator<T> |
expectException(org.hamcrest.Matcher<?> matcher)
Expect an exception to occur during command handler execution that matches with the given
matcher . |
ResultValidator<T> |
expectExceptionDetails(Class<?> exceptionDetails)
Expect the given
exceptionDetails type to occur during command handler execution. |
ResultValidator<T> |
expectExceptionDetails(org.hamcrest.Matcher<?> exceptionDetailsMatcher)
Expect exception details to occur during command handler execution that matches with the given
matcher . |
ResultValidator<T> |
expectExceptionDetails(Object exceptionDetails)
Expect the given
exceptionDetails to occur during command handler execution. |
ResultValidator<T> |
expectExceptionMessage(org.hamcrest.Matcher<?> exceptionMessageMatcher)
Expect an exception message to occur during command handler execution that matches with the given
matcher . |
ResultValidator<T> |
expectExceptionMessage(String exceptionMessage)
Expect the given
exceptionMessage to occur during command handler execution. |
ResultValidator<T> |
expectMarkedDeleted()
Asserts that the Aggregate has been marked for deletion.
|
ResultValidator<T> |
expectNoScheduledDeadline(Duration durationToScheduledTime,
Object deadline)
Asserts that no deadline equal to the given
deadline has been scheduled after the given durationToScheduledTime . |
ResultValidator<T> |
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. |
ResultValidator<T> |
expectNoScheduledDeadline(Instant scheduledTime,
Object deadline)
Asserts that no deadline equal to the given
deadline has been scheduled at the given scheduledTime . |
ResultValidator<T> |
expectNoScheduledDeadlineMatching(Duration durationToScheduledTime,
org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
Asserts that no deadline matching the given
matcher should be scheduled after the given durationToScheduledTime . |
ResultValidator<T> |
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. |
ResultValidator<T> |
expectNoScheduledDeadlineMatching(Instant scheduledTime,
org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
Asserts that no deadline matching the given
matcher has been scheduled at the given scheduledTime . |
ResultValidator<T> |
expectNoScheduledDeadlineMatching(org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
Asserts that no deadline matching the given
matcher is scheduled. |
ResultValidator<T> |
expectNoScheduledDeadlineOfType(Duration durationToScheduledTime,
Class<?> deadlineType)
Asserts that no deadline of the given
deadlineType has been scheduled after the given durationToScheduledTime . |
ResultValidator<T> |
expectNoScheduledDeadlineOfType(Instant scheduledTime,
Class<?> deadlineType)
Asserts that no deadline with the given
deadlineType has been scheduled at the given scheduledTime . |
ResultValidator<T> |
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. |
ResultValidator<T> |
expectNoScheduledDeadlines()
Asserts that no deadlines are scheduled.
|
ResultValidator<T> |
expectNoScheduledDeadlineWithName(Duration durationToScheduledTime,
String deadlineName)
Asserts that no deadline with the given
deadlineName has been scheduled after the given durationToScheduledTime . |
ResultValidator<T> |
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. |
ResultValidator<T> |
expectNoScheduledDeadlineWithName(Instant scheduledTime,
String deadlineName)
Asserts that no deadline with the given
deadlineName has been scheduled at the given scheduledTime . |
ResultValidator<T> |
expectNotMarkedDeleted()
Asserts that the Aggregate has NOT been marked for deletion.
|
ResultValidator<T> |
expectResultMessage(CommandResultMessage<?> expectedResultMessage)
Expect the command handler to return the given
expectedResultMessage after execution. |
ResultValidator<T> |
expectResultMessageMatching(org.hamcrest.Matcher<? super CommandResultMessage<?>> matcher)
Expect the command handler to return a value that matches the given
matcher after execution. |
ResultValidator<T> |
expectResultMessagePayload(Object expectedPayload)
Expect the command handler to return the given
expectedPayload after execution. |
ResultValidator<T> |
expectResultMessagePayloadMatching(org.hamcrest.Matcher<?> matcher)
Expect the command handler to return a payload that matches the given
matcher after execution. |
ResultValidator<T> |
expectScheduledDeadline(Duration duration,
Object deadline)
Asserts that a deadline equal to the given
deadline has been scheduled after the given duration . |
ResultValidator<T> |
expectScheduledDeadline(Instant scheduledTime,
Object deadline)
Asserts that a deadline equal to the given
deadline has been scheduled at the given scheduledTime . |
ResultValidator<T> |
expectScheduledDeadlineMatching(Duration duration,
org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
Asserts that a deadline scheduled after given
duration matches the given matcher . |
ResultValidator<T> |
expectScheduledDeadlineMatching(Instant scheduledTime,
org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
Asserts that a deadline matching the given
matcher has been scheduled at the given scheduledTime . |
ResultValidator<T> |
expectScheduledDeadlineOfType(Duration duration,
Class<?> deadlineType)
Asserts that a deadline of the given
deadlineType has been scheduled after the given duration . |
ResultValidator<T> |
expectScheduledDeadlineOfType(Instant scheduledTime,
Class<?> deadlineType)
Asserts that a deadline of the given
deadlineType has been scheduled at the given scheduledTime . |
ResultValidator<T> |
expectScheduledDeadlineWithName(Duration duration,
String deadlineName)
Asserts that a deadline with the given
deadlineName has been scheduled after the given duration . |
ResultValidator<T> |
expectScheduledDeadlineWithName(Instant scheduledTime,
String deadlineName)
Asserts that a deadline with the given
deadlineName has been scheduled at the given scheduledTime . |
ResultValidator<T> |
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.
|
ResultValidator<T> |
expectSuccessfulHandlerExecution()
Expect a successful execution of the given command handler, regardless of the actual return value.
|
ResultValidator<T> |
expectTriggeredDeadlines(Object... expected)
Asserts that given
expected deadlines have been triggered. |
ResultValidator<T> |
expectTriggeredDeadlinesMatching(org.hamcrest.Matcher<? extends List<? super DeadlineMessage<?>>> matcher)
Asserts that deadlines matching the given
matcher have been triggered for this aggregate. |
ResultValidator<T> |
expectTriggeredDeadlinesOfType(Class<?>... expectedDeadlineTypes)
Asserts that the given
expectedDeadlineTypes have been triggered. |
ResultValidator<T> |
expectTriggeredDeadlinesWithName(String... expectedDeadlineNames)
Asserts that the given
expectedDeadlineNames have been triggered. |
void |
onResult(CommandMessage<?> commandMessage,
CommandResultMessage<?> commandResultMessage)
Invoked when command handling execution is completed.
|
void |
recordException(Throwable exception)
Record the given
exception as a result of this validator. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
expectNoEvents
wrap
public ResultValidatorImpl(List<EventMessage<?>> publishedEvents, FieldFilter fieldFilter, Supplier<Aggregate<T>> aggregateState, StubDeadlineManager stubDeadlineManager)
storedEvents
and publishedEvents
.publishedEvents
- The events that were published during command executionfieldFilter
- The filter describing which fields to include in the comparisonpublic ResultValidator<T> expectEvents(Object... expectedEvents)
ResultValidator
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.
expectEvents
in interface ResultValidator<T>
expectedEvents
- The expected events, in the exact order they are expected to be dispatched and stored.public ResultValidator<T> expectEvents(EventMessage<?>... expectedEvents)
ResultValidator
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.
expectEvents
in interface ResultValidator<T>
expectedEvents
- The expected events, in the exact order they are expected to be dispatched and stored.public ResultValidator<T> expectEventsMatching(org.hamcrest.Matcher<? extends List<? super EventMessage<?>>> matcher)
ResultValidator
matcher
.
Note: if no events were published, the matcher receives an empty List.
expectEventsMatching
in interface ResultValidator<T>
matcher
- The matcher to match with the actually published eventspublic ResultValidator<T> expectSuccessfulHandlerExecution()
ResultValidator
expectSuccessfulHandlerExecution
in interface ResultValidator<T>
public ResultValidator<T> expectState(Consumer<T> aggregateStateValidator)
ResultValidator
Note that validating state on Event Sourced Aggregate is highly discouraged. Event Sourced aggregates should measure behavior exclusively by measuring emitted events.
expectState
in interface ResultValidator<T>
aggregateStateValidator
- a consumer that is provided with the aggregate instance, allowing it to make
assertions based on the aggregate's state.public ResultValidator<T> expectScheduledDeadlineMatching(Duration duration, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
ResultValidator
duration
matches the given matcher
.expectScheduledDeadlineMatching
in interface ResultValidator<T>
duration
- the delay expected before the deadline is metmatcher
- the matcher that must match with the deadline scheduled at the given timepublic ResultValidator<T> expectScheduledDeadline(Duration duration, Object deadline)
ResultValidator
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.expectScheduledDeadline
in interface ResultValidator<T>
duration
- the time to wait before the deadline should be metdeadline
- the expected deadlinepublic ResultValidator<T> expectScheduledDeadlineOfType(Duration duration, Class<?> deadlineType)
ResultValidator
deadlineType
has been scheduled after the given duration
.expectScheduledDeadlineOfType
in interface ResultValidator<T>
duration
- the time to wait before the deadline is metdeadlineType
- the type of the expected deadlinepublic ResultValidator<T> expectScheduledDeadlineWithName(Duration duration, String deadlineName)
ResultValidator
deadlineName
has been scheduled after the given duration
.expectScheduledDeadlineWithName
in interface ResultValidator<T>
duration
- the time to wait before the deadline is metdeadlineName
- the name of the expected deadlinepublic ResultValidator<T> expectScheduledDeadlineMatching(Instant scheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
ResultValidator
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".expectScheduledDeadlineMatching
in interface ResultValidator<T>
scheduledTime
- the time at which the deadline should be metmatcher
- the matcher defining the deadline expectedpublic ResultValidator<T> expectScheduledDeadline(Instant scheduledTime, Object deadline)
ResultValidator
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.expectScheduledDeadline
in interface ResultValidator<T>
scheduledTime
- the time at which the deadline is scheduleddeadline
- the expected deadlinepublic ResultValidator<T> expectScheduledDeadlineOfType(Instant scheduledTime, Class<?> deadlineType)
ResultValidator
deadlineType
has been scheduled at the given scheduledTime
.expectScheduledDeadlineOfType
in interface ResultValidator<T>
scheduledTime
- the time at which the deadline is scheduleddeadlineType
- the type of the expected deadlinepublic ResultValidator<T> expectScheduledDeadlineWithName(Instant scheduledTime, String deadlineName)
ResultValidator
deadlineName
has been scheduled at the given scheduledTime
.expectScheduledDeadlineWithName
in interface ResultValidator<T>
scheduledTime
- the time at which the deadline is scheduleddeadlineName
- the name of the expected deadlinepublic ResultValidator<T> expectNoScheduledDeadlines()
ResultValidator
expectNoScheduledDeadlines
in interface ResultValidator<T>
public ResultValidator<T> expectNoScheduledDeadlineMatching(org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
ResultValidator
matcher
is scheduled. Can be used to validate if a
deadline has never been set or has been canceled.expectNoScheduledDeadlineMatching
in interface ResultValidator<T>
matcher
- the matcher defining the deadline which should not be scheduledpublic ResultValidator<T> expectNoScheduledDeadlineMatching(Duration durationToScheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
ResultValidator
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.expectNoScheduledDeadlineMatching
in interface ResultValidator<T>
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 scheduledpublic ResultValidator<T> expectNoScheduledDeadline(Duration durationToScheduledTime, Object deadline)
ResultValidator
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.expectNoScheduledDeadline
in interface ResultValidator<T>
durationToScheduledTime
- the time to wait until the trigger point of the deadline which should not be
scheduleddeadline
- the deadline which should not be scheduledpublic ResultValidator<T> expectNoScheduledDeadlineOfType(Duration durationToScheduledTime, Class<?> deadlineType)
ResultValidator
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.expectNoScheduledDeadlineOfType
in interface ResultValidator<T>
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 scheduledpublic ResultValidator<T> expectNoScheduledDeadlineWithName(Duration durationToScheduledTime, String deadlineName)
ResultValidator
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.expectNoScheduledDeadlineWithName
in interface ResultValidator<T>
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 scheduledpublic ResultValidator<T> expectNoScheduledDeadlineMatching(Instant scheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
ResultValidator
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".expectNoScheduledDeadlineMatching
in interface ResultValidator<T>
scheduledTime
- the time at which no deadline matching the given matcher
should be scheduledmatcher
- the matcher defining the deadline which should not be scheduledpublic ResultValidator<T> expectNoScheduledDeadline(Instant scheduledTime, Object deadline)
ResultValidator
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.expectNoScheduledDeadline
in interface ResultValidator<T>
scheduledTime
- the time at which no deadline equal to the given deadline
should be scheduleddeadline
- the deadline which should not be scheduledpublic ResultValidator<T> expectNoScheduledDeadlineOfType(Instant scheduledTime, Class<?> deadlineType)
ResultValidator
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.expectNoScheduledDeadlineOfType
in interface ResultValidator<T>
scheduledTime
- the time at which no deadline of deadlineType
should be scheduleddeadlineType
- the type of the deadline which should not be scheduledpublic ResultValidator<T> expectNoScheduledDeadlineWithName(Instant scheduledTime, String deadlineName)
ResultValidator
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.expectNoScheduledDeadlineWithName
in interface ResultValidator<T>
scheduledTime
- the time at which no deadline of deadlineName
should be scheduleddeadlineName
- the name of the deadline which should not be scheduledpublic ResultValidator<T> expectNoScheduledDeadlineMatching(Instant from, Instant to, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
ResultValidator
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.expectNoScheduledDeadlineMatching
in interface ResultValidator<T>
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 scheduledpublic ResultValidator<T> expectNoScheduledDeadline(Instant from, Instant to, Object deadline)
ResultValidator
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.expectNoScheduledDeadline
in interface ResultValidator<T>
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 scheduledpublic ResultValidator<T> expectNoScheduledDeadlineOfType(Instant from, Instant to, Class<?> deadlineType)
ResultValidator
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.expectNoScheduledDeadlineOfType
in interface ResultValidator<T>
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 scheduledpublic ResultValidator<T> expectNoScheduledDeadlineWithName(Instant from, Instant to, String deadlineName)
ResultValidator
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.expectNoScheduledDeadlineWithName
in interface ResultValidator<T>
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 scheduledpublic ResultValidator<T> expectDeadlinesMetMatching(org.hamcrest.Matcher<? extends List<? super DeadlineMessage<?>>> matcher)
ResultValidator
matcher
have been met (which have passed in time) on this aggregate.expectDeadlinesMetMatching
in interface ResultValidator<T>
matcher
- The matcher that defines the expected list of deadlinespublic ResultValidator<T> expectTriggeredDeadlinesMatching(org.hamcrest.Matcher<? extends List<? super DeadlineMessage<?>>> matcher)
ResultValidator
matcher
have been triggered for this aggregate.expectTriggeredDeadlinesMatching
in interface ResultValidator<T>
matcher
- the matcher that defines the expected list of deadlinespublic ResultValidator<T> expectDeadlinesMet(Object... expected)
ResultValidator
expected
deadlines have been met (which have passed in time). Deadlines are compared
comparing their type and fields using "equals".expectDeadlinesMet
in interface ResultValidator<T>
expected
- The sequence of deadlines expected to be metpublic ResultValidator<T> expectTriggeredDeadlines(Object... expected)
ResultValidator
expected
deadlines have been triggered. Deadlines are compared by their type
and fields using "equals".expectTriggeredDeadlines
in interface ResultValidator<T>
expected
- the sequence of deadlines expected to have been triggeredpublic ResultValidator<T> expectTriggeredDeadlinesWithName(String... expectedDeadlineNames)
ResultValidator
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()
.expectTriggeredDeadlinesWithName
in interface ResultValidator<T>
expectedDeadlineNames
- the sequence of deadline names expected to have been triggeredpublic ResultValidator<T> expectTriggeredDeadlinesOfType(Class<?>... expectedDeadlineTypes)
ResultValidator
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()
.expectTriggeredDeadlinesOfType
in interface ResultValidator<T>
expectedDeadlineTypes
- the sequence of deadline types expected to have been triggeredpublic ResultValidator<T> expectResultMessagePayload(Object expectedPayload)
ResultValidator
expectedPayload
after execution. The actual and expected
values are compared using their equals methods.expectResultMessagePayload
in interface ResultValidator<T>
expectedPayload
- The expected result message payload of the command executionpublic ResultValidator<T> expectResultMessagePayloadMatching(org.hamcrest.Matcher<?> matcher)
ResultValidator
matcher
after execution.expectResultMessagePayloadMatching
in interface ResultValidator<T>
matcher
- The matcher to verify the actual return value againstpublic ResultValidator<T> expectResultMessage(CommandResultMessage<?> expectedResultMessage)
ResultValidator
expectedResultMessage
after execution. The actual and
expected values are compared using their equals methods.
Comparison is done on message payload and meta data.
expectResultMessage
in interface ResultValidator<T>
expectedResultMessage
- The expected result message of the command executionpublic ResultValidator<T> expectResultMessageMatching(org.hamcrest.Matcher<? super CommandResultMessage<?>> matcher)
ResultValidator
matcher
after execution.expectResultMessageMatching
in interface ResultValidator<T>
matcher
- The matcher to verify the actual result message againstpublic ResultValidator<T> expectExceptionMessage(org.hamcrest.Matcher<?> exceptionMessageMatcher)
ResultValidator
matcher
.expectExceptionMessage
in interface ResultValidator<T>
exceptionMessageMatcher
- The matcher to validate the actual exception messagepublic ResultValidator<T> expectExceptionMessage(String exceptionMessage)
ResultValidator
exceptionMessage
to occur during command handler execution. The actual exception message
should be exactly the same as exceptionMessage
.expectExceptionMessage
in interface ResultValidator<T>
exceptionMessage
- The exception message expected from the command handler executionpublic ResultValidator<T> expectException(Class<? extends Throwable> expectedException)
ResultValidator
expectedException
to occur during command handler execution. The actual exception should
be exactly of that type, subclasses are not accepted.expectException
in interface ResultValidator<T>
expectedException
- The type of exception expected from the command handler executionpublic ResultValidator<T> expectException(org.hamcrest.Matcher<?> matcher)
ResultValidator
matcher
.expectException
in interface ResultValidator<T>
matcher
- The matcher to validate the actual exceptionpublic ResultValidator<T> expectExceptionDetails(Object exceptionDetails)
ResultValidator
exceptionDetails
to occur during command handler execution. The actual exception details
should be exactly the same as exceptionDetails
.expectExceptionDetails
in interface ResultValidator<T>
exceptionDetails
- The exception details expected from the command handler executionpublic ResultValidator<T> expectExceptionDetails(Class<?> exceptionDetails)
ResultValidator
exceptionDetails
type to occur during command handler execution. The actual exception details
should be exactly of that type, subclasses are not accepted.expectExceptionDetails
in interface ResultValidator<T>
exceptionDetails
- The type of exception details expected from the command handler executionpublic ResultValidator<T> expectExceptionDetails(org.hamcrest.Matcher<?> exceptionDetailsMatcher)
ResultValidator
matcher
.expectExceptionDetails
in interface ResultValidator<T>
exceptionDetailsMatcher
- The matcher to validate the actual exception detailspublic ResultValidator<T> expectMarkedDeleted()
ResultValidator
expectMarkedDeleted
in interface ResultValidator<T>
public ResultValidator<T> expectNotMarkedDeleted()
ResultValidator
expectNotMarkedDeleted
in interface ResultValidator<T>
public void onResult(@Nonnull CommandMessage<?> commandMessage, @Nonnull CommandResultMessage<?> commandResultMessage)
CommandCallback
onResult
in interface CommandCallback<Object,Object>
commandMessage
- the CommandMessage
that was dispatchedcommandResultMessage
- the CommandResultMessage
of the command handling executionpublic void recordException(Throwable exception)
exception
as a result of this validator.exception
- The exception to record as a result of this validator.public void assertValidRecording()
Copyright © 2010–2024. All rights reserved.