ExpectedResult

data class ExpectedResult<T : Any>(val exchange: DomainEventExchange<*>, val processor: T, val commandStream: CommandStream?, val error: Throwable? = null) : StatelessSagaExpecter<T, ExpectedResult<T>>

Represents the expected result of a stateless saga processing operation.

This data class encapsulates the outcome of processing a domain event through a stateless saga, including the event exchange, processor, generated commands, and any errors that occurred.

Parameters

T

The type of the saga processor.

Constructors

Link copied to clipboard
constructor(exchange: DomainEventExchange<*>, processor: T, commandStream: CommandStream?, error: Throwable? = null)

Properties

Link copied to clipboard

The stream of commands generated by the saga, or null if none.

Link copied to clipboard

Any error that occurred during processing, or null if successful.

Link copied to clipboard

The domain event exchange that triggered the saga processing.

Link copied to clipboard

Indicates whether an error occurred during saga processing.

Link copied to clipboard

The saga processor instance that handled the event.

Functions

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

Sets expectations on the expected result using a lambda.

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

Sets expectations on the first command in the command stream.

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

Sets expectations on the body of the first command.

Link copied to clipboard
open fun expectCommandCount(expected: Int): ExpectedResult<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

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

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

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

open fun expectCommandType(vararg expected: KClass<*>): ExpectedResult<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): ExpectedResult<T>

Expects a specific error with custom assertions.

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

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

open fun <E : Throwable> expectErrorType(expected: KClass<E>): ExpectedResult<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.