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 Details

    • 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 given consumer of 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

      AxonTestPhase.Then.Command resultMessagePayload(@Nonnull Object expectedPayload)
      Expect the last command handler from the When phase to return the given expectedPayload after 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.
      Use resultMessagePayloadSatisfies(Class, Consumer) instead, which automatically handles payload conversion for distributed setups where conversion is necessary.
      Invokes the given consumer of 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, use resultMessagePayloadSatisfies(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 given consumer of the command result payload that has been returned during the When phase, after converting it to the expected type. This method automatically handles payload conversion using the configured MessageConverter.
      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.