Package org.axonframework.test.fixture
Interface AxonTestPhase.Then.Command
- All Superinterfaces:
AxonTestPhase.Then.Message<AxonTestPhase.Then.Command>,AxonTestPhase.Then.MessageAssertions<AxonTestPhase.Then.Command>
- Enclosing interface:
AxonTestPhase.Then
public static interface AxonTestPhase.Then.Command
extends AxonTestPhase.Then.Message<AxonTestPhase.Then.Command>
Operations available in the Then phase of the test fixture execution only if command was dispatched during
the When phase.
-
Method Summary
Modifier and TypeMethodDescriptionresultMessagePayload(Object expectedPayload) Expect the last command handler from the When phase to return the givenexpectedPayloadafter execution.resultMessagePayloadSatisfies(Class<T> type, Consumer<T> consumer) Invokes the givenconsumerof the command result payload that has been returned during the When phase, after converting it to the expectedtype.resultMessagePayloadSatisfies(Consumer<Object> consumer) Deprecated, for removal: This API element is subject to removal in a future version.resultMessageSatisfies(Consumer<? super CommandResultMessage> consumer) Invokes the givenconsumerof the command result message that has been returned during the When phase, allowing for any form of assertion.success()Expect a successful execution of the When phase, regardless of the actual return value.Methods inherited from interface org.axonframework.test.fixture.AxonTestPhase.Then.Message
and, await, await, stopMethods inherited from interface org.axonframework.test.fixture.AxonTestPhase.Then.MessageAssertions
commands, commands, commandsMatch, commandsSatisfy, events, events, eventsMatch, eventsSatisfy, exception, exception, exceptionSatisfies, expect, expectAsync, noCommands, noEvents
-
Method Details
-
success
AxonTestPhase.Then.Command success()Expect a successful execution of the When phase, regardless of the actual return value.- Returns:
- The current Then instance, for fluent interfacing.
-
resultMessageSatisfies
AxonTestPhase.Then.Command resultMessageSatisfies(@Nonnull Consumer<? super CommandResultMessage> consumer) Invokes the givenconsumerof the command result message that has been returned during the When phase, allowing for any form of assertion.- Parameters:
consumer- Consumes the command result. You may place your own assertions here.- Returns:
- The current Then instance, for fluent interfacing.
-
resultMessagePayload
Expect the last command handler from the When phase to return the givenexpectedPayloadafter execution. The actual and expected values are compared using their equals methods.Only take commands into account that were dispatched explicitly with the
AxonTestPhase.When.command(java.lang.Object). Hence, do not take into accounts commands dispatched as side effects of the message handlers.- Parameters:
expectedPayload- The expected result message payload of the command execution.- Returns:
- The current Then, for fluent interfacing.
-
resultMessagePayloadSatisfies
@Deprecated(since="5.1.0", forRemoval=true) AxonTestPhase.Then.Command resultMessagePayloadSatisfies(@Nonnull Consumer<Object> consumer) Deprecated, for removal: This API element is subject to removal in a future version.UseresultMessagePayloadSatisfies(Class, Consumer)instead, which automatically handles payload conversion for distributed setups where conversion is necessary.Invokes the givenconsumerof the command result payload that has been returned during the When phase, allowing for any form of assertion.Note: Depending on the infrastructure, the payload may require conversion (e.g., from
byte[]or other intermediate representations). If you need to perform assertions on a typed payload, useresultMessagePayloadSatisfies(Class, Consumer)instead, which automatically converts the payload to the expected type.- Parameters:
consumer- Consumes the command result payload. You may place your own assertions here.- Returns:
- The current Then instance, for fluent interfacing.
- See Also:
-
resultMessagePayloadSatisfies
<T> AxonTestPhase.Then.Command resultMessagePayloadSatisfies(@Nonnull Class<T> type, @Nonnull Consumer<T> consumer) Invokes the givenconsumerof the command result payload that has been returned during the When phase, after converting it to the expectedtype. This method automatically handles payload conversion using the configuredMessageConverter.- Type Parameters:
T- The type of the payload.- Parameters:
type- The expected type of the payload.consumer- Consumes the converted command result payload. You may place your own assertions here.- Returns:
- The current Then instance, for fluent interfacing.
-
resultMessagePayloadSatisfies(Class, Consumer)instead, which automatically handles payload conversion for distributed setups where conversion is necessary.