Package org.axonframework.test.fixture
Interface AxonTestPhase.Then.Message<T extends AxonTestPhase.Then.Message<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 Superinterfaces:
AxonTestPhase.Then.MessageAssertions<T>
- All Known Subinterfaces:
AxonTestPhase.Then.Command,AxonTestPhase.Then.Event,AxonTestPhase.Then.Nothing
- Enclosing interface:
AxonTestPhase.Then
public static interface AxonTestPhase.Then.Message<T extends AxonTestPhase.Then.Message<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 Summary
Modifier and TypeMethodDescriptionand()Returns to the setup phase to continue with additional test scenarios.default TWaits until the givenassertionpasses or the default timeout of 5 seconds is reached.Waits until the givenassertionpasses or the giventimeoutis reached.default voidstop()Stops the fixture, releasing any active resources, like registered handlers or pending event processing tasks.Methods 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
-
await
Waits until the givenassertionpasses or the default timeout of 5 seconds is reached. The assertion receives the current Then instance, allowing to invoke any of its assertion methods.- Parameters:
assertion- The assertion to wait for. The assertion will be invoked on the current Then instance.- Returns:
- The current Then instance, for fluent interfacing.
-
await
Waits until the givenassertionpasses or the giventimeoutis reached. The assertion receives the current Then instance, allowing to invoke any of its assertion methods.- Parameters:
assertion- The assertion to wait for. The assertion will be invoked on the current Then instance.timeout- The maximum time to wait for the assertion to pass. If the timeout is reached, the assertion.- Returns:
- The current Then instance, for fluent interfacing.
-
and
AxonTestPhase.Setup and()Returns to the setup phase to continue with additional test scenarios. This allows for chaining multiple test scenarios within a single test method. The same configuration from the original fixture is reused, so all components are shared among the invocations.Example usage:
fixture.given() .event(new AccountCreatedEvent("account-1")) .when() .command(new WithdrawMoneyCommand("account-1", 50.00)) .then() .events(new MoneyWithdrawnEvent("account-1", 50.00)) .success() .and() // Return to setup phase with same configuration .given() // Start a new scenario .event(new AccountCreatedEvent("account-2")) .when() .command(new WithdrawMoneyCommand("account-2", 30.00)) .then() .events(new MoneyWithdrawnEvent("account-2", 30.00));- Returns:
- A
AxonTestPhase.Setupinstance that allows configuring a new test scenario.
-
stop
default void stop()Stops the fixture, releasing any active resources, like registered handlers or pending event processing tasks.
-