T
- The type of Aggregate under testpublic interface TestExecutor<T>
when(Object)
, which dispatches a command on this fixture's Command Bus.Modifier and Type | Method and Description |
---|---|
TestExecutor<T> |
andGiven(List<?> domainEvents)
Configures the given
domainEvents as the "given" events. |
TestExecutor<T> |
andGiven(Object... domainEvents)
Configures the given
domainEvents as the "given" events. |
TestExecutor<T> |
andGivenCommands(List<?> commands)
Configures the given
commands as the command that will provide the "given" events. |
TestExecutor<T> |
andGivenCommands(Object... commands)
Configures the given
commands as the command that will provide the "given" events. |
TestExecutor<T> |
andGivenCurrentTime(Instant currentTime)
Use this method to indicate a specific moment as the initial current time "known" by the fixture at the start
of the given state.
|
default ResultValidator |
andThenTimeAdvancesTo(Instant newPointInTime)
Deprecated.
in favor of
whenThenTimeAdvancesTo(Instant) . This function incorrectly suggests you can
proceed with other operations after calling it, which is made impossible due to the ResultValidator
return type |
default ResultValidator |
andThenTimeElapses(Duration elapsedTime)
Deprecated.
in favor of
whenThenTimeElapses(Duration) . This function incorrectly suggests you can
proceed with other operations after calling it, which is made impossible due to the ResultValidator
return type |
Instant |
currentTime()
Returns the time as "known" by the fixture.
|
ResultValidator<T> |
when(Object command)
Dispatches the given command to the appropriate command handler and records all activity in the fixture for
result validation.
|
ResultValidator<T> |
when(Object command,
Map<String,?> metaData)
Dispatches the given command and meta data to the appropriate command handler and records all
activity in the fixture for result validation.
|
ResultValidator |
whenThenTimeAdvancesTo(Instant newPointInTime)
Simulates the time advancing in the current given state using an
Instant as the unit of time. |
ResultValidator |
whenThenTimeElapses(Duration elapsedTime)
Simulates the time elapsing in the current given state using a
Duration as the unit of time. |
ResultValidator<T> when(Object command)
command
is a CommandMessage
instance, it will be dispatched as-is. Any other object will
cause the given command
to be wrapped in a CommandMessage
as its payload.command
- The command to executeResultValidator<T> when(Object command, Map<String,?> metaData)
command
is a CommandMessage
instance, it will be dispatched as-is, with given
additional metaData
. Any other object will cause the given command
to be wrapped in a
CommandMessage
as its payload.command
- The command to executemetaData
- The meta data to attach to theTestExecutor<T> andGiven(Object... domainEvents)
domainEvents
as the "given" events. These are the events returned by the event
store when an aggregate is loaded.
If an item in the given domainEvents
implements Message
, the
payload and meta data from that message are copied into a newly created Domain Event Message. Otherwise, a
Domain Event Message with the item as payload and empty meta data is created.domainEvents
- the domain events the event store should returnTestExecutor<T> andGiven(List<?> domainEvents)
domainEvents
as the "given" events. These are the events returned by the event
store when an aggregate is loaded.
If an item in the list implements Message
, the payload and meta data from that
message are copied into a newly created Domain Event Message. Otherwise, a Domain Event Message with the item
as payload and empty meta data is created.domainEvents
- the domain events the event store should returnTestExecutor<T> andGivenCommands(Object... commands)
commands
as the command that will provide the "given" events. The commands are
executed, and the resulting stored events are captured.commands
- the domain events the event store should returnTestExecutor<T> andGivenCommands(List<?> commands)
commands
as the command that will provide the "given" events. The commands are
executed, and the resulting stored events are captured.commands
- the domain events the event store should returnTestExecutor<T> andGivenCurrentTime(Instant currentTime)
currentTime
- The simulated "current time" at which the given state is initializedInstant currentTime()
@Deprecated default ResultValidator andThenTimeElapses(Duration elapsedTime)
whenThenTimeElapses(Duration)
. This function incorrectly suggests you can
proceed with other operations after calling it, which is made impossible due to the ResultValidator
return typeDuration
as the unit of time. This can be
useful when the time between given events is of importance, for example when leveraging the
DeadlineManager
to schedule deadlines in the context of a given Aggregate.elapsedTime
- a Duration
specifying the amount of time that will elapseResultValidator
that can be used to validate the resulting actions of the command executionResultValidator whenThenTimeElapses(Duration elapsedTime)
Duration
as the unit of time. This can be
useful when the time between given events is of importance, for example when leveraging the
DeadlineManager
to schedule deadlines in the context of a given Aggregate.elapsedTime
- a Duration
specifying the amount of time that will elapseResultValidator
that can be used to validate the resulting actions of the command execution@Deprecated default ResultValidator andThenTimeAdvancesTo(Instant newPointInTime)
whenThenTimeAdvancesTo(Instant)
. This function incorrectly suggests you can
proceed with other operations after calling it, which is made impossible due to the ResultValidator
return typeInstant
as the unit of time. This can be
useful when the time between given events is of importance, for example when leveraging the
DeadlineManager
to schedule deadlines in the context of a given Aggregate.newPointInTime
- an Instant
specifying the amount of time to advance the clock toResultValidator
that can be used to validate the resulting actions of the command executionResultValidator whenThenTimeAdvancesTo(Instant newPointInTime)
Instant
as the unit of time. This can be
useful when the time between given events is of importance, for example when leveraging the
DeadlineManager
to schedule deadlines in the context of a given Aggregate.newPointInTime
- an Instant
specifying the amount of time to advance the clock toResultValidator
that can be used to validate the resulting actions of the command executionCopyright © 2010–2022. All rights reserved.