ExpectStage

Interface for defining and executing expectations on saga test results.

This interface extends StatelessSagaExpecter and provides methods to verify that all accumulated expectations are met by the actual saga results.

Parameters

T

The type of the saga being tested.

Functions

Link copied to clipboard
abstract fun expect(expected: ExpectedResult<T>.() -> Unit): ExpectStage<T>

Sets expectations on the expected result using a lambda.

Link copied to clipboard
open fun <C : Any> expectCommand(expected: CommandMessage<C>.() -> Unit): ExpectStage<T>

Sets expectations on the first command in the command stream.

Link copied to clipboard
open fun <C : Any> expectCommandBody(expected: C.() -> Unit): ExpectStage<T>

Sets expectations on the body of the first command.

Link copied to clipboard
open fun expectCommandCount(expected: Int): ExpectStage<T>

Expects a specific number of commands in the command stream.

Link copied to clipboard

Sets expectations on a command iterator created from the command stream.

Link copied to clipboard
open fun expectCommandStream(expected: CommandStream.() -> Unit): ExpectStage<T>

Sets expectations on the command stream, ensuring no error occurred first.

Link copied to clipboard
open fun expectCommandType(vararg expected: Class<*>): ExpectStage<T>

Expects commands of specific types in order (Java Class version).

open fun expectCommandType(vararg expected: KClass<*>): ExpectStage<T>

Expects commands of specific types in order.

Link copied to clipboard

Expects that an error occurred during saga processing.

open fun <E : Throwable> expectError(expected: E.() -> Unit): ExpectStage<T>

Expects a specific error with custom assertions.

Link copied to clipboard
open fun <E : Throwable> expectErrorType(expected: Class<E>): ExpectStage<T>

Expects an error of a specific type (Java Class version).

open fun <E : Throwable> expectErrorType(expected: KClass<E>): ExpectStage<T>

Expects an error of a specific type.

Link copied to clipboard

Expects that no commands were generated by the saga.

Link copied to clipboard

Expects that no error occurred during saga processing.

Link copied to clipboard
open fun verify(): ExpectedResult<T>

Verifies all expectations immediately.

abstract fun verify(immediately: Boolean): ExpectedResult<T>

Executes the verification logic after completing the test flow orchestration.