public class FixtureExecutionResultImpl<T> extends Object implements FixtureExecutionResult
Modifier and Type | Method and Description |
---|---|
FixtureExecutionResult |
expectActiveSagas(int expected)
Expect the given number of Sagas to be active (i.e.
|
FixtureExecutionResult |
expectAssociationWith(String associationKey,
Object associationValue)
Asserts that at least one of the active sagas is associated with the given
associationKey and associationValue . |
FixtureExecutionResult |
expectDeadlinesMet(Object... expected)
Asserts that given
expected deadlines have been met (which have passed in time). |
FixtureExecutionResult |
expectDeadlinesMetMatching(org.hamcrest.Matcher<? extends List<? super DeadlineMessage<?>>> matcher)
Asserts that deadlines match given
matcher have been met (which have passed in time) on this saga. |
FixtureExecutionResult |
expectDispatchedCommands(Object... expected)
Asserts that the given commands have been dispatched in exactly the order given.
|
FixtureExecutionResult |
expectDispatchedCommandsMatching(org.hamcrest.Matcher<? extends List<? super CommandMessage<?>>> matcher)
Asserts that the sagas dispatched commands as defined by the given
matcher . |
FixtureExecutionResult |
expectNoAssociationWith(String associationKey,
Object associationValue)
Asserts that at none of the active sagas is associated with the given
associationKey and associationValue . |
FixtureExecutionResult |
expectNoDispatchedCommands()
Asserts that the sagas did not dispatch any commands.
|
FixtureExecutionResult |
expectNoScheduledDeadline(Duration duration,
Object deadline)
Asserts that no deadline equal to the given
deadline has been scheduled after the given duration . |
FixtureExecutionResult |
expectNoScheduledDeadline(Instant scheduledTime,
Object deadline)
Asserts that no deadline equal to the given
deadline has been scheduled at the given scheduledTime . |
FixtureExecutionResult |
expectNoScheduledDeadlineMatching(Duration duration,
org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
Asserts that no deadline matching the given
matcher should be scheduled after the given duration . |
FixtureExecutionResult |
expectNoScheduledDeadlineMatching(Instant scheduledTime,
org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
Asserts that no deadline matching the given
matcher has been scheduled at the given scheduledTime . |
FixtureExecutionResult |
expectNoScheduledDeadlineMatching(org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
Asserts that no deadline matching the given
matcher is scheduled. |
FixtureExecutionResult |
expectNoScheduledDeadlineOfType(Duration duration,
Class<?> deadlineType)
Asserts that no deadline of the given
deadlineType has been scheduled at the given scheduledTime . |
FixtureExecutionResult |
expectNoScheduledDeadlineOfType(Instant scheduledTime,
Class<?> deadlineType)
Asserts that no deadline with the given
deadlineType has been scheduled at the given scheduledTime . |
FixtureExecutionResult |
expectNoScheduledDeadlines()
Asserts that no deadlines are scheduled.
|
FixtureExecutionResult |
expectNoScheduledDeadlineWithName(Duration duration,
String deadlineName)
Asserts that no deadline with the given
deadlineName has been scheduled after the given duration . |
FixtureExecutionResult |
expectNoScheduledDeadlineWithName(Instant scheduledTime,
String deadlineName)
Asserts that no deadline with the given
deadlineName has been scheduled at the given scheduledTime . |
FixtureExecutionResult |
expectNoScheduledEvent(Duration duration,
Object event)
Asserts that no event equal to the given
event has been scheduled after the given duration . |
FixtureExecutionResult |
expectNoScheduledEvent(Instant scheduledTime,
Object event)
Asserts that no event equal to the given
event has been scheduled at the given scheduledTime . |
FixtureExecutionResult |
expectNoScheduledEventMatching(Duration duration,
org.hamcrest.Matcher<? super EventMessage<?>> matcher)
Asserts that no event matching the given
matcher has been scheduled to be published after the
given duration . |
FixtureExecutionResult |
expectNoScheduledEventMatching(Instant scheduledTime,
org.hamcrest.Matcher<? super EventMessage<?>> matcher)
Asserts that no event matching the given
matcher has been scheduled at the given scheduledTime . |
FixtureExecutionResult |
expectNoScheduledEventOfType(Duration duration,
Class<?> eventType)
Asserts that no event of the given
eventType has been scheduled after the given duration . |
FixtureExecutionResult |
expectNoScheduledEventOfType(Instant scheduledTime,
Class<?> eventType)
Asserts that no event with the given
eventType has been scheduled at the given scheduledTime . |
FixtureExecutionResult |
expectNoScheduledEvents()
Assert that no events are scheduled for publication.
|
FixtureExecutionResult |
expectPublishedEvents(Object... expected)
Assert that the saga published events on the EventBus in the exact sequence of the given
expected events. |
FixtureExecutionResult |
expectPublishedEventsMatching(org.hamcrest.Matcher<? extends List<? super EventMessage<?>>> matcher)
Assert that the saga published events on the EventBus as defined by the given
matcher . |
FixtureExecutionResult |
expectScheduledDeadline(Duration duration,
Object deadline)
Asserts that a deadline equal to the given
deadline has been scheduled after the given duration . |
FixtureExecutionResult |
expectScheduledDeadline(Instant scheduledTime,
Object deadline)
Asserts that a deadline equal to the given
deadline has been scheduled at the given scheduledTime . |
FixtureExecutionResult |
expectScheduledDeadlineMatching(Duration duration,
org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
Asserts that a deadline scheduled after given
duration matches the given matcher . |
FixtureExecutionResult |
expectScheduledDeadlineMatching(Instant scheduledTime,
org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
Asserts that a deadline matching the given
matcher has been scheduled at the given scheduledTime . |
FixtureExecutionResult |
expectScheduledDeadlineOfType(Duration duration,
Class<?> deadlineType)
Asserts that a deadline of the given
deadlineType has been scheduled after the given duration . |
FixtureExecutionResult |
expectScheduledDeadlineOfType(Instant scheduledTime,
Class<?> deadlineType)
Asserts that a deadline of the given
deadlineType has been scheduled at the given scheduledTime . |
FixtureExecutionResult |
expectScheduledDeadlineWithName(Duration duration,
String deadlineName)
Asserts that a deadline with the given
deadlineName has been scheduled after the given duration . |
FixtureExecutionResult |
expectScheduledDeadlineWithName(Instant scheduledTime,
String deadlineName)
Asserts that a deadline with the given
deadlineName has been scheduled at the given scheduledTime . |
FixtureExecutionResult |
expectScheduledEvent(Duration duration,
Object applicationEvent)
Asserts that an event equal to the given
event has been scheduled for publication after the given duration . |
FixtureExecutionResult |
expectScheduledEvent(Instant scheduledTime,
Object applicationEvent)
Asserts that an event equal to the given
event has been scheduled for publication at the given scheduledTime . |
FixtureExecutionResult |
expectScheduledEventMatching(Duration duration,
org.hamcrest.Matcher<? super EventMessage<?>> matcher)
Asserts that an event matching the given
matcher has been scheduled to be published after the given
duration . |
FixtureExecutionResult |
expectScheduledEventMatching(Instant scheduledTime,
org.hamcrest.Matcher<? super EventMessage<?>> matcher)
Asserts that an event matching the given
matcher has been scheduled to be published at the given scheduledTime . |
FixtureExecutionResult |
expectScheduledEventOfType(Duration duration,
Class<?> eventType)
Asserts that an event of the given
eventType has been scheduled for publication after the given duration . |
FixtureExecutionResult |
expectScheduledEventOfType(Instant scheduledTime,
Class<?> eventType)
Asserts that an event of the given
eventType has been scheduled for publication at the given scheduledTime . |
void |
registerStartRecordingCallback(Runnable onStartRecordingCallback)
Registers a callback to be invoked when the fixture execution starts recording.
|
void |
startRecording()
Tells this class to start monitoring activity in infrastructure classes.
|
public void registerStartRecordingCallback(Runnable onStartRecordingCallback)
onStartRecordingCallback
- callback to invokepublic void startRecording()
public FixtureExecutionResult expectActiveSagas(int expected)
FixtureExecutionResult
expectActiveSagas
in interface FixtureExecutionResult
expected
- the expected number of active events in the repositorypublic FixtureExecutionResult expectAssociationWith(String associationKey, Object associationValue)
FixtureExecutionResult
associationKey
and associationValue
.expectAssociationWith
in interface FixtureExecutionResult
associationKey
- The key of the association to verifyassociationValue
- The value of the association to verifypublic FixtureExecutionResult expectNoAssociationWith(String associationKey, Object associationValue)
FixtureExecutionResult
associationKey
and associationValue
.expectNoAssociationWith
in interface FixtureExecutionResult
associationKey
- The key of the association to verifyassociationValue
- The value of the association to verifypublic FixtureExecutionResult expectScheduledEventMatching(Duration duration, org.hamcrest.Matcher<? super EventMessage<?>> matcher)
FixtureExecutionResult
matcher
has been scheduled to be published after the given
duration
.expectScheduledEventMatching
in interface FixtureExecutionResult
duration
- The time to wait before the event should be publishedmatcher
- A matcher defining the event expected to be publishedpublic FixtureExecutionResult expectScheduledDeadlineMatching(Duration duration, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
FixtureExecutionResult
duration
matches the given matcher
.expectScheduledDeadlineMatching
in interface FixtureExecutionResult
duration
- The delay expected before the deadline is metmatcher
- The matcher that must match with the deadline scheduled at the given timepublic FixtureExecutionResult expectScheduledEvent(Duration duration, Object applicationEvent)
FixtureExecutionResult
event
has been scheduled for publication after the given duration
.
Note that the source attribute of the event is ignored when comparing events. Events are compared using an
"equals" check on all fields in the events.expectScheduledEvent
in interface FixtureExecutionResult
duration
- The time to wait before the event should be publishedapplicationEvent
- The expected eventpublic FixtureExecutionResult expectScheduledDeadline(Duration duration, Object deadline)
FixtureExecutionResult
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 FixtureExecutionResult
duration
- The time to wait before the deadline should be metdeadline
- The expected deadlinepublic FixtureExecutionResult expectScheduledEventOfType(Duration duration, Class<?> eventType)
FixtureExecutionResult
eventType
has been scheduled for publication after the given duration
.expectScheduledEventOfType
in interface FixtureExecutionResult
duration
- The time to wait before the event should be publishedeventType
- The type of the expected eventpublic FixtureExecutionResult expectScheduledDeadlineOfType(Duration duration, Class<?> deadlineType)
FixtureExecutionResult
deadlineType
has been scheduled after the given duration
.expectScheduledDeadlineOfType
in interface FixtureExecutionResult
duration
- The time to wait before the deadline is metdeadlineType
- The type of the expected deadlinepublic FixtureExecutionResult expectScheduledDeadlineWithName(Duration duration, String deadlineName)
FixtureExecutionResult
deadlineName
has been scheduled after the given duration
.expectScheduledDeadlineWithName
in interface FixtureExecutionResult
duration
- the time to wait before the deadline is metdeadlineName
- the name of the expected deadlinepublic FixtureExecutionResult expectScheduledEventMatching(Instant scheduledTime, org.hamcrest.Matcher<? super EventMessage<?>> matcher)
FixtureExecutionResult
matcher
has been scheduled to be published at the given scheduledTime
.
If the scheduledTime
is calculated based on the "current time", use the FixtureConfiguration.currentTime()
to get the time to use as "current time".expectScheduledEventMatching
in interface FixtureExecutionResult
scheduledTime
- The time at which the event should be publishedmatcher
- A matcher defining the event expected to be publishedpublic FixtureExecutionResult expectScheduledDeadlineMatching(Instant scheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
FixtureExecutionResult
matcher
has been scheduled at the given scheduledTime
.
If the scheduledTime
is calculated based on the "current time", use the FixtureConfiguration.currentTime()
to get the time to use as "current time".expectScheduledDeadlineMatching
in interface FixtureExecutionResult
scheduledTime
- The time at which the deadline should be metmatcher
- The matcher defining the deadline expectedpublic FixtureExecutionResult expectScheduledEvent(Instant scheduledTime, Object applicationEvent)
FixtureExecutionResult
event
has been scheduled for publication at the given scheduledTime
.
If the scheduledTime
is calculated based on the "current time", use the FixtureConfiguration.currentTime()
to get the time to use as "current time".
Note that the source attribute of the event is ignored when comparing events. Events are compared using an
"equals" check on all fields in the events.expectScheduledEvent
in interface FixtureExecutionResult
scheduledTime
- The time at which the event should be publishedapplicationEvent
- The expected eventpublic FixtureExecutionResult expectScheduledDeadline(Instant scheduledTime, Object deadline)
FixtureExecutionResult
deadline
has been scheduled at the given scheduledTime
.
If the scheduledTime
is calculated based on the "current time", use the FixtureConfiguration.currentTime()
to get the time to use as "current time".
Note that the source attribute of the deadline is ignored when comparing deadlines. Deadlines are compared using
an "equals" check on all fields in the deadlines.expectScheduledDeadline
in interface FixtureExecutionResult
scheduledTime
- The time at which the deadline is scheduleddeadline
- The expected deadlinepublic FixtureExecutionResult expectScheduledEventOfType(Instant scheduledTime, Class<?> eventType)
FixtureExecutionResult
eventType
has been scheduled for publication at the given scheduledTime
.
If the scheduledTime
is calculated based on the "current time", use the FixtureConfiguration.currentTime()
to get the time to use as "current time".expectScheduledEventOfType
in interface FixtureExecutionResult
scheduledTime
- The time at which the event should be publishedeventType
- The type of the expected eventpublic FixtureExecutionResult expectScheduledDeadlineOfType(Instant scheduledTime, Class<?> deadlineType)
FixtureExecutionResult
deadlineType
has been scheduled at the given scheduledTime
.expectScheduledDeadlineOfType
in interface FixtureExecutionResult
scheduledTime
- The time at which the deadline is scheduleddeadlineType
- The type of the expected deadlinepublic FixtureExecutionResult expectScheduledDeadlineWithName(Instant scheduledTime, String deadlineName)
FixtureExecutionResult
deadlineName
has been scheduled at the given scheduledTime
.expectScheduledDeadlineWithName
in interface FixtureExecutionResult
scheduledTime
- the time at which the deadline is scheduleddeadlineName
- the name of the expected deadlinepublic FixtureExecutionResult expectDispatchedCommands(Object... expected)
FixtureExecutionResult
If exact order doesn't matter, or the validation needs be done in another way than "equal payload", consider
using FixtureExecutionResult.expectDispatchedCommandsMatching(Matcher)
instead.
expectDispatchedCommands
in interface FixtureExecutionResult
expected
- The expected commandspublic FixtureExecutionResult expectDispatchedCommandsMatching(org.hamcrest.Matcher<? extends List<? super CommandMessage<?>>> matcher)
FixtureExecutionResult
matcher
. Only commands as a result of
the event in the "when" stage of the fixture are matched.expectDispatchedCommandsMatching
in interface FixtureExecutionResult
matcher
- The matcher that describes the expected list of commandspublic FixtureExecutionResult expectNoDispatchedCommands()
FixtureExecutionResult
expectNoDispatchedCommands
in interface FixtureExecutionResult
public FixtureExecutionResult expectNoScheduledEvents()
FixtureExecutionResult
expectNoScheduledEvents
in interface FixtureExecutionResult
public FixtureExecutionResult expectNoScheduledEventMatching(Duration duration, org.hamcrest.Matcher<? super EventMessage<?>> matcher)
FixtureExecutionResult
matcher
has been scheduled to be published after the
given duration
.expectNoScheduledEventMatching
in interface FixtureExecutionResult
duration
- the time at which no event matching the given matcher
should be scheduledmatcher
- the matcher defining the event which should not be scheduledpublic FixtureExecutionResult expectNoScheduledEvent(Duration duration, Object event)
FixtureExecutionResult
event
has been scheduled after the given duration
.
Note that the source attribute of the event is ignored when comparing events. Events are compared using an
"equals" check on all fields in the events.expectNoScheduledEvent
in interface FixtureExecutionResult
duration
- the time at which no event equal to the given event
should be scheduledevent
- the event which should not be scheduledpublic FixtureExecutionResult expectNoScheduledEventOfType(Duration duration, Class<?> eventType)
FixtureExecutionResult
eventType
has been scheduled after the given duration
.expectNoScheduledEventOfType
in interface FixtureExecutionResult
duration
- the time at which no event of eventType
should be scheduledeventType
- the type of the event which should not be scheduledpublic FixtureExecutionResult expectNoScheduledEventMatching(Instant scheduledTime, org.hamcrest.Matcher<? super EventMessage<?>> matcher)
FixtureExecutionResult
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".expectNoScheduledEventMatching
in interface FixtureExecutionResult
scheduledTime
- the time at which no event matching the given matcher
should be scheduledmatcher
- the matcher defining the event which should not be scheduledpublic FixtureExecutionResult expectNoScheduledEvent(Instant scheduledTime, Object event)
FixtureExecutionResult
event
has been scheduled at the given scheduledTime
.
If the scheduledTime
is calculated based on the "current time", use the TestExecutor.currentTime()
to get the time to use as "current time".
Note that the source attribute of the event is ignored when comparing events. Events are compared using an
"equals" check on all fields in the events.expectNoScheduledEvent
in interface FixtureExecutionResult
scheduledTime
- the time at which no event equal to the given event
should be scheduledevent
- the event which should not be scheduledpublic FixtureExecutionResult expectNoScheduledEventOfType(Instant scheduledTime, Class<?> eventType)
FixtureExecutionResult
eventType
has been scheduled at the given scheduledTime
.expectNoScheduledEventOfType
in interface FixtureExecutionResult
scheduledTime
- the time at which no event of eventType
should be scheduledeventType
- the type of the event which should not be scheduledpublic FixtureExecutionResult expectNoScheduledDeadlines()
FixtureExecutionResult
expectNoScheduledDeadlines
in interface FixtureExecutionResult
public FixtureExecutionResult expectNoScheduledDeadlineMatching(org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
FixtureExecutionResult
matcher
is scheduled.expectNoScheduledDeadlineMatching
in interface FixtureExecutionResult
matcher
- the matcher defining the deadline which should not be scheduledpublic FixtureExecutionResult expectNoScheduledDeadlineMatching(Duration duration, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
FixtureExecutionResult
matcher
should be scheduled after the given duration
.expectNoScheduledDeadlineMatching
in interface FixtureExecutionResult
duration
- the time at which no deadline matching the given matcher
should be scheduledmatcher
- the matcher defining the deadline which should not be scheduledpublic FixtureExecutionResult expectNoScheduledDeadline(Duration duration, Object deadline)
FixtureExecutionResult
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.expectNoScheduledDeadline
in interface FixtureExecutionResult
duration
- the time at which no deadline equal to the given deadline
should be scheduleddeadline
- the deadline which should not be scheduledpublic FixtureExecutionResult expectNoScheduledDeadlineOfType(Duration duration, Class<?> deadlineType)
FixtureExecutionResult
deadlineType
has been scheduled at the given scheduledTime
.expectNoScheduledDeadlineOfType
in interface FixtureExecutionResult
duration
- the time at which no deadline of deadlineType
should be scheduleddeadlineType
- the type of the deadline which should not be scheduledpublic FixtureExecutionResult expectNoScheduledDeadlineWithName(Duration duration, String deadlineName)
FixtureExecutionResult
deadlineName
has been scheduled after the given duration
.expectNoScheduledDeadlineWithName
in interface FixtureExecutionResult
duration
- the time at which no deadline of deadlineName
should be scheduleddeadlineName
- the name of the deadline which should not be scheduledpublic FixtureExecutionResult expectNoScheduledDeadlineMatching(Instant scheduledTime, org.hamcrest.Matcher<? super DeadlineMessage<?>> matcher)
FixtureExecutionResult
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".expectNoScheduledDeadlineMatching
in interface FixtureExecutionResult
scheduledTime
- the time at which no deadline matching the given matcher
should be scheduledmatcher
- the matcher defining the deadline which should not be scheduledpublic FixtureExecutionResult expectNoScheduledDeadline(Instant scheduledTime, Object deadline)
FixtureExecutionResult
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.expectNoScheduledDeadline
in interface FixtureExecutionResult
scheduledTime
- the time at which no deadline equal to the given deadline
should be scheduleddeadline
- the deadline which should not be scheduledpublic FixtureExecutionResult expectNoScheduledDeadlineOfType(Instant scheduledTime, Class<?> deadlineType)
FixtureExecutionResult
deadlineType
has been scheduled at the given scheduledTime
.expectNoScheduledDeadlineOfType
in interface FixtureExecutionResult
scheduledTime
- the time at which no deadline of deadlineType
should be scheduleddeadlineType
- the type of the deadline which should not be scheduledpublic FixtureExecutionResult expectNoScheduledDeadlineWithName(Instant scheduledTime, String deadlineName)
FixtureExecutionResult
deadlineName
has been scheduled at the given scheduledTime
.expectNoScheduledDeadlineWithName
in interface FixtureExecutionResult
scheduledTime
- the time at which no deadline of deadlineName
should be scheduleddeadlineName
- the name of the deadline which should not be scheduledpublic FixtureExecutionResult expectPublishedEventsMatching(org.hamcrest.Matcher<? extends List<? super EventMessage<?>>> matcher)
FixtureExecutionResult
matcher
. Only events
published in the "when" stage of the tests are matched.expectPublishedEventsMatching
in interface FixtureExecutionResult
matcher
- The matcher that defines the expected list of published events.public FixtureExecutionResult expectDeadlinesMetMatching(org.hamcrest.Matcher<? extends List<? super DeadlineMessage<?>>> matcher)
FixtureExecutionResult
matcher
have been met (which have passed in time) on this saga.expectDeadlinesMetMatching
in interface FixtureExecutionResult
matcher
- The matcher that defines the expected list of deadlinespublic FixtureExecutionResult expectPublishedEvents(Object... expected)
FixtureExecutionResult
expected
events.
Events are compared comparing their type and fields using equals. Sequence number and aggregate identifier (for
domain events) are ignored in the comparison.expectPublishedEvents
in interface FixtureExecutionResult
expected
- The sequence of events expected to be published by the Sagapublic FixtureExecutionResult expectDeadlinesMet(Object... expected)
FixtureExecutionResult
expected
deadlines have been met (which have passed in time). Deadlines are compared
comparing their type and fields using "equals".expectDeadlinesMet
in interface FixtureExecutionResult
expected
- The sequence of deadlines expected to be metCopyright © 2010–2020. All rights reserved.