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.
|
ResultValidator |
andThenTimeAdvancesTo(Instant newDateTime)
Simulates time shifts in the current given state.
|
ResultValidator |
andThenTimeElapses(Duration elapsedTime)
Simulates time shifts in the current given state.
|
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<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()
ResultValidator andThenTimeElapses(Duration elapsedTime)
elapsedTime
- The amount of time that will elapseResultValidator andThenTimeAdvancesTo(Instant newDateTime)
newDateTime
- The time to advance the clock toCopyright © 2010–2018. All rights reserved.