Interface AxonTestPhase.Given
- Enclosing interface:
AxonTestPhase
-
Method Summary
Modifier and TypeMethodDescriptiondefault AxonTestPhase.GivenConfigures a single command as part of the "given" state.default AxonTestPhase.GivenConfigures a single command with the givenmetadataas part of the "given" state.Configures a single command with the givenmetadataas part of the "given" state.default AxonTestPhase.GivenConfigures the givencommandsas commands in the "given" state.Configures the givencommandsas commands in the "given" state.commands(CommandMessage... messages) Configures the givenmessagesas commands in the "given" state.default AxonTestPhase.GivenConfigures a single event as part of the "given" state.default AxonTestPhase.GivenConfigures a single event with the givenmetadataas part of the "given" state.Configures a single event with the givenmetadataas part of the "given" state.default AxonTestPhase.GivenConfigures the giveneventsas events in the "given" state.Configures the giveneventsas events in the "given" state.events(EventMessage... messages) Configures the givenmessagesas events in the "given" state.default AxonTestPhase.Givenexecute(Consumer<Configuration> consumer) Allows running custom setup steps (other than executing messages) on any component retrievable from theConfiguration.executeAsync(Function<Configuration, CompletableFuture<?>> function) Allows running custom setup steps (other than executing messages) on any component retrievable from theConfiguration.Indicates that no relevant activities like commands or events have occurred in the past.then()Transitions to the Then phase to validate the results of the test.when()Transitions to the When phase to execute the test action.
-
Method Details
-
noPriorActivity
AxonTestPhase.Given noPriorActivity()Indicates that no relevant activities like commands or events have occurred in the past. This also means that no previous state is present in the system.- Returns:
- The current Given instance, for fluent interfacing
-
event
Configures a single event as part of the "given" state. This 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 Given instance, for fluent interfacing.
-
event
Configures a single event with the givenmetadataas part of the "given" state. This event will be published.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 Given instance, for fluent interfacing.
-
event
Configures a single event with the givenmetadataas part of the "given" state. This event will be published.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 Given instance, for fluent interfacing.
-
events
Configures the givenmessagesas events in the "given" state. These events will be published in the order they are provided.All the
messageswill be processed within a single Unit of Work, meaning their processing won't be affected by changes made by earlier messages passed to this method.- Parameters:
messages- The event messages to publish.- Returns:
- The current Given instance, for fluent interfacing.
-
events
Configures the giveneventsas events in the "given" state. These events will be published in the order they are provided.All the
messageswill be processed within a single Unit of Work, meaning their processing won't be affected by changes made by earlier messages passed to this method.- Parameters:
events- The lists of events to publish.- Returns:
- The current Given instance, for fluent interfacing.
-
events
Configures the giveneventsas events in the "given" state. These events will be published in the order they are provided.All the
messageswill be processed within a single Unit of Work, meaning their processing won't be affected by changes made by earlier messages passed to this method.- Parameters:
events- The lists of events to publish.- Returns:
- The current Given instance, for fluent interfacing.
-
command
Configures a single command as part of the "given" state. This command will be dispatched to corresponding command handlers 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 Given instance, for fluent interfacing.
-
command
Configures a single command with the givenmetadataas part of the "given" state. This command will be dispatched to corresponding command handlers.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 Given instance, for fluent interfacing.
-
command
Configures a single command with the givenmetadataas part of the "given" state. This command will be dispatched to corresponding command handlers.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 Given instance, for fluent interfacing.
-
commands
Configures the givenmessagesas commands in the "given" state.Each message will be processed in a dedicated Unit of Work, meaning that the processing of a message will be affected by the state changes made by the processing of previous messages. This behavior is in contrast to the
events(org.axonframework.messaging.eventhandling.EventMessage...)method, where all messages are processed within a single Unit of Work.- Parameters:
messages- The command messages to dispatch.- Returns:
- The current Given instance, for fluent interfacing.
-
commands
Configures the givencommandsas commands in the "given" state. These commands will be dispatched in the order they are provided in the same Unit of Work.Each message will be processed in a dedicated Unit of Work, meaning that the processing of a message will be affected by the state changes made by the processing of previous messages. This behavior is in contrast to the
events(org.axonframework.messaging.eventhandling.EventMessage...)method, where all messages are processed within a single Unit of Work.- Parameters:
commands- The command messages to dispatch.- Returns:
- The current Given instance, for fluent interfacing.
-
commands
Configures the givencommandsas commands in the "given" state. These commands will be dispatched in the order they are provided in the same Unit of Work.Each message will be processed in a dedicated Unit of Work, meaning that the processing of a message will be affected by the state changes made by the processing of previous messages. This behavior is in contrast to the
events(org.axonframework.messaging.eventhandling.EventMessage...)method, where all messages are processed within a single Unit of Work.- Parameters:
commands- The command messages to dispatch.- Returns:
- The current Given instance, for fluent interfacing.
-
execute
Allows running custom setup steps (other than executing messages) on any component retrievable from theConfiguration.- Parameters:
consumer- The consumer to execute on the configuration.- Returns:
- The current Given instance, for fluent interfacing.
-
executeAsync
Allows running custom setup steps (other than executing messages) on any component retrievable from theConfiguration.- Parameters:
function- The function to execute on the configuration.- Returns:
- The current Given instance, for fluent interfacing.
-
when
AxonTestPhase.When when()Transitions to the When phase to execute the test action.- Returns:
- A
AxonTestPhase.Wheninstance that allows executing the test.
-
then
AxonTestPhase.Then.Nothing then()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.
-