Interface AxonTestPhase.Then.MessageAssertions<T extends AxonTestPhase.Then.MessageAssertions<T>>

Type Parameters:
T - The type of the current Then instance, for fluent interfacing. The type depends on the operation which was triggered in the When phase.
All Known Subinterfaces:
AxonTestPhase.Then.Command, AxonTestPhase.Then.Event, AxonTestPhase.Then.Message<T>, AxonTestPhase.Then.Nothing
Enclosing interface:
AxonTestPhase.Then

public static interface AxonTestPhase.Then.MessageAssertions<T extends AxonTestPhase.Then.MessageAssertions<T>>
Interface describing the operations available in the Then phase of the test fixture execution. It's possible to assert published messages from the When phase.
  • Method Details

    • events

      T events(@Nonnull Object... expectedEvents)
      Expect the given set of events to have been published during the AxonTestPhase.When phase.

      All events are compared for equality using a shallow equals comparison on all the fields of the events. This means that all assigned values on the events' fields should have a proper equals implementation.

      Note that the EventMessage.identifier() is ignored in the comparison.

      Parameters:
      expectedEvents - The expected events, in the exact order they are expected to be published.
      Returns:
      The current Then instance, for fluent interfacing.
    • events

      T events(@Nonnull EventMessage... expectedEvents)
      Expect the given set of event messages to have been published during the AxonTestPhase.When phase.

      All events are compared for equality using a shallow equals comparison on all the fields of the events. This means that all assigned values on the events' fields should have a proper equals implementation. Additionally, the metadata will be compared too.

      Note that the EventMessage.identifier() is ignored in the comparison.

      Parameters:
      expectedEvents - The expected event messages, in the exact order they are expected to be published.
      Returns:
      The current Then instance, for fluent interfacing.
    • eventsSatisfy

      T eventsSatisfy(@Nonnull Consumer<List<EventMessage>> consumer)
      Invokes the given consumer of the set of event messages that have been published during the When phase, allowing for any form of assertion.
      Parameters:
      consumer - Consumes the published events. You may place your own assertions here.
      Returns:
      The current Then instance, for fluent interfacing.
    • eventsMatch

      T eventsMatch(@Nonnull Predicate<List<EventMessage>> predicate)
      Allow to check if the set of event messages which have been published during the When phase match given predicate.
      Parameters:
      predicate - The predicate to check the dispatched events against.
      Returns:
      The current Then instance, for fluent interfacing.
    • noEvents

      default T noEvents()
      Expect no events to have been published during the AxonTestPhase.When phase.
      Returns:
      The current Then instance, for fluent interfacing.
    • commands

      T commands(@Nonnull Object... expectedCommands)
      Expect the given set of commands to have been dispatched during the When phase.

      All commands are compared for equality using a shallow equals comparison on all the fields of the commands. This means that all assigned values on the commands' fields should have a proper equals implementation.

      Parameters:
      expectedCommands - The expected commands, in the exact order they are expected to be dispatched.
      Returns:
      The current Then instance, for fluent interfacing.
    • commands

      T commands(@Nonnull CommandMessage... expectedCommands)
      Expect the given set of command messages to have been dispatched during the When phase.

      All commands are compared for equality using a shallow equals comparison on all the fields of the commands. This means that all assigned values on the commands' fields should have a proper equals implementation. Additionally, the metadata will be compared too.

      Parameters:
      expectedCommands - The expected command messages, in the exact order they are expected to be dispatched.
      Returns:
      The current Then instance, for fluent interfacing.
    • commandsSatisfy

      T commandsSatisfy(@Nonnull Consumer<List<CommandMessage>> consumer)
      Invokes the given consumer of the set of command messages that have been dispatched during the When phase, allowing for any form of assertion. *
      Parameters:
      consumer - Consumes the dispatched commands. You may place your own assertions here.
      Returns:
      The current Then instance, for fluent interfacing.
    • commandsMatch

      T commandsMatch(@Nonnull Predicate<List<CommandMessage>> predicate)
      Allow to check if the set of command messages which have been dispatched during the When phase match given predicate.
      Parameters:
      predicate - The predicate to check the dispatched commands against.
      Returns:
      The current Then instance, for fluent interfacing.
    • noCommands

      T noCommands()
      Expect no command messages to have been dispatched during the When phase.
      Returns:
      The current Then instance, for fluent interfacing.
    • exception

      T exception(@Nonnull Class<? extends Throwable> type)
      Expect the given expectedException to occur during the When phase execution. The actual exception should be exactly of that type, subclasses are not accepted.

      Only take messages into account that were published explicitly with the AxonTestPhase.When.command(java.lang.Object) or AxonTestPhase.When.event(java.lang.Object). Hence, do not take into accounts messages published as side effects of other message handlers present in the configuration.

      Parameters:
      type - The type of exception expected from the When phase execution.
      Returns:
      The current Then instance, for fluent interfacing.
    • exception

      T exception(@Nonnull Class<? extends Throwable> type, @Nonnull String message)
      Expect the exception with given type and message to occur during the When phase execution. The actual exception should be exactly of that type, subclasses are not accepted.

      Only take messages into account that were published explicitly with the AxonTestPhase.When.command(java.lang.Object) or AxonTestPhase.When.event(java.lang.Object). Hence, do not take into accounts messages published as side effects of other message handlers present in the configuration.

      Parameters:
      type - The type of exception expected from the When phase execution.
      message - The message of the exception expected from the When phase execution.
      Returns:
      The current Then instance, for fluent interfacing.
    • exceptionSatisfies

      T exceptionSatisfies(@Nonnull Consumer<Throwable> consumer)
      Invokes the given consumer of the exception that has been throw during the When phase, allowing for any form of assertion.
      Parameters:
      consumer - Consumes the thrown exception. You may place your own assertions here.
      Returns:
      The current Then instance, for fluent interfacing.
    • expect

      T expect(@Nonnull Consumer<Configuration> function)
      Allows running assertions on any component retrievable from the Configuration.
      Parameters:
      function - The function to execute on the configuration.
      Returns:
      The current Then instance, for fluent interfacing.
    • expectAsync

      T expectAsync(@Nonnull Function<Configuration,CompletableFuture<?>> function)
      Allows running assertions on any component retrievable from the Configuration.
      Parameters:
      function - The function to execute on the configuration.
      Returns:
      The current Then instance, for fluent interfacing.