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
-
Method Summary
Modifier and TypeMethodDescriptionExpect the given set of commands to have been dispatched during the When phase.commands(CommandMessage... expectedCommands) Expect the given set of command messages to have been dispatched during the When phase.commandsMatch(Predicate<List<CommandMessage>> predicate) Allow to check if the set of command messages which have been dispatched during the When phase match given predicate.commandsSatisfy(Consumer<List<CommandMessage>> consumer) Invokes the givenconsumerof the set of command messages that have been dispatched during the When phase, allowing for any form of assertionExpect the given set of events to have been published during theAxonTestPhase.Whenphase.events(EventMessage... expectedEvents) Expect the given set of event messages to have been published during theAxonTestPhase.Whenphase.eventsMatch(Predicate<List<EventMessage>> predicate) Allow to check if the set of event messages which have been published during the When phase match givenpredicate.eventsSatisfy(Consumer<List<EventMessage>> consumer) Invokes the givenconsumerof the set of event messages that have been published during the When phase, allowing for any form of assertion.Expect the givenexpectedExceptionto occur during the When phase execution.Expect the exception with giventypeandmessageto occur during the When phase execution.exceptionSatisfies(Consumer<Throwable> consumer) Invokes the givenconsumerof the exception that has been throw during the When phase, allowing for any form of assertion.expect(Consumer<Configuration> function) Allows running assertions on any component retrievable from theConfiguration.expectAsync(Function<Configuration, CompletableFuture<?>> function) Allows running assertions on any component retrievable from theConfiguration.Expect no command messages to have been dispatched during the When phase.default TnoEvents()Expect no events to have been published during theAxonTestPhase.Whenphase.
-
Method Details
-
events
Expect the given set of events to have been published during theAxonTestPhase.Whenphase.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
Expect the given set of event messages to have been published during theAxonTestPhase.Whenphase.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
Invokes the givenconsumerof 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
Allow to check if the set of event messages which have been published during the When phase match givenpredicate.- Parameters:
predicate- The predicate to check the dispatched events against.- Returns:
- The current Then instance, for fluent interfacing.
-
noEvents
Expect no events to have been published during theAxonTestPhase.Whenphase.- Returns:
- The current Then instance, for fluent interfacing.
-
commands
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
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
Invokes the givenconsumerof 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
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
Expect the givenexpectedExceptionto 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)orAxonTestPhase.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
Expect the exception with giventypeandmessageto 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)orAxonTestPhase.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
Invokes the givenconsumerof 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
Allows running assertions on any component retrievable from theConfiguration.- Parameters:
function- The function to execute on the configuration.- Returns:
- The current Then instance, for fluent interfacing.
-
expectAsync
Allows running assertions on any component retrievable from theConfiguration.- Parameters:
function- The function to execute on the configuration.- Returns:
- The current Then instance, for fluent interfacing.
-