DefaultExpectDsl

Default implementation of ExpectDsl that creates dynamic JUnit 5 tests for each expectation.

This class wraps an ExpectStage and converts each expectation method call into a DynamicTest that can be executed by JUnit 5's dynamic test framework. Each expectation is verified without immediately throwing exceptions, allowing for better test reporting.

Parameters

T

The type of the saga being tested.

Constructors

Link copied to clipboard
constructor(delegate: ExpectStage<T>)

Properties

Link copied to clipboard
open override val delegate: ExpectStage<T>

The underlying expect stage that performs the actual verification.

Link copied to clipboard
open override val dynamicNodes: MutableList<DynamicNode>

A mutable list of dynamic test nodes that can be modified by subclasses.

Functions

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

Creates a dynamic test for custom expectations on the expected result.

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

Creates a dynamic test for expectations on the first command.

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

Creates a dynamic test for expectations on the first command's body.

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

Creates a dynamic test expecting a specific number of commands.

Link copied to clipboard
open override fun expectCommandIterator(expected: CommandIterator.() -> Unit): ExpectDsl<T>

Creates a dynamic test for expectations on a command iterator.

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

Creates a dynamic test for expectations on the command stream.

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

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

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

Creates a dynamic test expecting commands of specific types in order.

Link copied to clipboard
open override fun expectError(): ExpectDsl<T>

Creates a dynamic test expecting an error occurred.

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

Creates a dynamic test for expectations on a specific error.

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

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

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

Creates a dynamic test expecting an error of a specific type.

Link copied to clipboard
open override fun expectNoCommand(): ExpectDsl<T>

Creates a dynamic test expecting no commands to be generated.

Link copied to clipboard
open override fun expectNoError(): ExpectDsl<T>

Creates a dynamic test expecting no error occurred.