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
whenTimeAdvancesTo(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
whenTimeElapses(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<T> |
whenThenTimeAdvancesTo(Instant newPointInTime)
Deprecated.
since 4.6. Use
whenTimeAdvancesTo(Instant) method |
ResultValidator<T> |
whenThenTimeElapses(Duration elapsedTime)
Deprecated.
since 4.6. Use
whenTimeAdvancesTo(Instant) method |
default ResultValidator<T> |
whenTimeAdvancesTo(Instant newPointInTime)
Simulates the time advancing in the current given state using an
Instant as the unit of time. |
default ResultValidator<T> |
whenTimeElapses(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)
whenTimeElapses(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 execution@Deprecated ResultValidator<T> whenThenTimeElapses(Duration elapsedTime)
whenTimeAdvancesTo(Instant)
methodDuration
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 executiondefault ResultValidator<T> whenTimeElapses(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.
Note: As this method is added to the interface as a replacement for the deprecated
whenThenTimeAdvancesTo(Instant)
method, and in case there are other implementations by 3rd party
libraries, this method is changed to a default method that rely on the deprecated method so that there is no
breaking changes in the API in case an external implementation of this interface. Nevertheless, the recomended
approach is to override this implementation.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)
whenTimeAdvancesTo(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 execution@Deprecated ResultValidator<T> whenThenTimeAdvancesTo(Instant newPointInTime)
whenTimeAdvancesTo(Instant)
methodInstant
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 executiondefault ResultValidator<T> whenTimeAdvancesTo(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.
Note: As this method is added to the interface as a replacement for the deprecated
whenThenTimeAdvancesTo(Instant)
method, and in case there are other implementations by 3rd party
libraries, this method is changed to a default method that rely on the deprecated method so that there is no
breaking changes in the API in case an external implementation of this interface. Nevertheless, the recomended
approach is to override this implementation.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–2023. All rights reserved.