Interface AxonTestPhase.When
- Enclosing interface:
AxonTestPhase
Each operation in the phase (such as dispatching a command) is executed in its own separate Unit of Work which is committed immediately after execution. This allows for building up the initial state incrementally with each operation being processed independently.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault AxonTestPhase.When.CommandDispatches the given command to the appropriate command handler and records all activity for result validation.default AxonTestPhase.When.CommandDispatches the given command with the providedmetadatato the appropriate command handler and records all activity for result validation.Dispatches the given command with the providedmetadatato the appropriate command handler and records all activity for result validation.default AxonTestPhase.When.EventPublishes the given event to the appropriate event handler and records all activity for result validation.default AxonTestPhase.When.EventPublishes the given event with the providedmetadatato the appropriate event handler and records all activity for result validation.Publishes the given event with the providedmetadatato the appropriate event handler and records all activity for result validation.default AxonTestPhase.When.EventPublishes the given events to the appropriate event handlers and records all activity for result validation.Publishes the given events to the appropriate event handlers and records all activity for result validation.events(EventMessage... messages) Publishes the given Event Messages to the appropriate event handlers and records all activity for result validation.nothing()Transitions to the Then phase to validate the results of the test.
-
Method Details
-
command
Dispatches the given command to the appropriate command handler and records all activity for result validation. The command will be dispatched with empty metadata.The
payloadparameter accepts either a command payload object or aCommandMessage. If aCommandMessageis provided, it will be used directly.- Parameters:
payload- The command payload orCommandMessageto dispatch.- Returns:
- The current When instance, for fluent interfacing.
-
command
default AxonTestPhase.When.Command command(@Nonnull Object payload, @Nonnull Map<String, String> metadata) Dispatches the given command with the providedmetadatato the appropriate command handler and records all activity for result validation.The
payloadparameter accepts either a command payload object or aCommandMessage. If aCommandMessageis provided, the givenmetadatawill be merged with the message's existing metadata usingCommandMessage.andMetadata(Metadata).- Parameters:
payload- The command payload orCommandMessageto dispatch.metadata- The metadata to attach to the command (merged if payload is aCommandMessage).- Returns:
- The current When instance, for fluent interfacing.
-
command
Dispatches the given command with the providedmetadatato the appropriate command handler and records all activity for result validation.The
payloadparameter accepts either a command payload object or aCommandMessage. If aCommandMessageis provided, the givenmetadatawill be merged with the message's existing metadata usingCommandMessage.andMetadata(Metadata).- Parameters:
payload- The command payload orCommandMessageto dispatch.metadata- The metadata to attach to the command (merged if payload is aCommandMessage).- Returns:
- The current When instance, for fluent interfacing.
-
event
Publishes the given event to the appropriate event handler and records all activity for result validation. The event will be published with empty metadata.The
payloadparameter accepts either an event payload object or anEventMessage. If anEventMessageis provided, it will be used directly.- Parameters:
payload- The event payload orEventMessageto publish.- Returns:
- The current When instance, for fluent interfacing.
-
event
default AxonTestPhase.When.Event event(@Nonnull Object payload, @Nonnull Map<String, String> metadata) Publishes the given event with the providedmetadatato the appropriate event handler and records all activity for result validation.The
payloadparameter accepts either an event payload object or anEventMessage. If anEventMessageis provided, the givenmetadatawill be merged with the message's existing metadata usingEventMessage.andMetadata(Metadata).- Parameters:
payload- The event payload orEventMessageto publish.metadata- The metadata to attach to the event (merged if payload is anEventMessage).- Returns:
- The current When instance, for fluent interfacing.
-
event
Publishes the given event with the providedmetadatato the appropriate event handler and records all activity for result validation.The
payloadparameter accepts either an event payload object or anEventMessage. If anEventMessageis provided, the givenmetadatawill be merged with the message's existing metadata usingEventMessage.andMetadata(Metadata).- Parameters:
payload- The event payload orEventMessageto publish.metadata- The metadata to attach to the event (merged if payload is anEventMessage).- Returns:
- The current When instance, for fluent interfacing.
-
events
Publishes the given Event Messages to the appropriate event handlers and records all activity for result validation.- Parameters:
messages- The event messages to publish.- Returns:
- The current When instance, for fluent interfacing.
-
events
Publishes the given events to the appropriate event handlers and records all activity for result validation. The events will be published with empty metadata.- Parameters:
events- The events (payloads or EventMessages) to publish.- Returns:
- The current When instance, for fluent interfacing.
-
events
Publishes the given events to the appropriate event handlers and records all activity for result validation.- Parameters:
events- The list of events to publish.- Returns:
- The current When instance, for fluent interfacing.
-
nothing
AxonTestPhase.When.Nothing nothing()Transitions to the Then phase to validate the results of the test. It skips the When phase.- Returns:
- A
AxonTestPhase.Then.Nothinginstance that allows validating the test results.
-