ExpectDsl

Defines the "Expect" phase of aggregate testing where results are validated.

This interface extends AggregateExpecter to provide comprehensive assertion methods for validating command execution results, and adds the fork method for creating branching test scenarios.

Parameters

S

the type of the aggregate state

Inheritors

Properties

Link copied to clipboard

The aggregate DSL context for managing shared test state.

Functions

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

Applies custom expectations to the test result.

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

Expects that an error occurred during command execution.

open fun <E : Throwable> expectError(expected: Consumer<E>): ExpectDsl<S>

Expects a specific error with detailed validation using a Consumer.

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

Expects a specific error with detailed validation.

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

Expects an error of a specific type (Java-friendly overload).

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

Expects an error of a specific type.

Link copied to clipboard
open fun <E : Any> expectEvent(expected: Consumer<DomainEvent<E>>): ExpectDsl<S>

Expects specific conditions on the first domain event using a Consumer.

open fun <E : Any> expectEvent(expected: DomainEvent<E>.() -> Unit): ExpectDsl<S>

Expects specific conditions on the first domain event in the stream.

Link copied to clipboard
open fun <E : Any> expectEventBody(expected: Consumer<E>): ExpectDsl<S>

Expects specific conditions on the body of the first domain event using a Consumer.

open fun <E : Any> expectEventBody(expected: E.() -> Unit): ExpectDsl<S>

Expects specific conditions on the body of the first domain event.

Link copied to clipboard
open fun expectEventCount(expected: Int): ExpectDsl<S>

Expects a specific number of events in the domain event stream.

Link copied to clipboard

Expects specific conditions on an event iterator using a Consumer.

open fun expectEventIterator(expected: EventIterator.() -> Unit): ExpectDsl<S>

Expects specific conditions on an event iterator for the domain event stream.

Link copied to clipboard

Expects specific conditions on the domain event stream using a Consumer.

open fun expectEventStream(expected: DomainEventStream.() -> Unit): ExpectDsl<S>

Expects specific conditions on the domain event stream.

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

Expects events of specific types in the exact order provided (Java-friendly overload).

open fun expectEventType(vararg expected: KClass<*>): ExpectDsl<S>

Expects events of specific types in the exact order provided.

Link copied to clipboard

Expects that no error occurred during command execution.

Link copied to clipboard
open fun expectState(expected: Consumer<S>): ExpectDsl<S>

Expects specific conditions on the aggregate state object using a Consumer.

open fun expectState(expected: S.() -> Unit): ExpectDsl<S>

Expects specific conditions on the aggregate state object.

Link copied to clipboard
open fun expectStateAggregate(expected: StateAggregate<S>.() -> Unit): ExpectDsl<S>

Expects specific conditions on the aggregate state and metadata.

Link copied to clipboard
abstract fun fork(name: String = "", verifyError: Boolean = false, block: ForkedVerifiedStageDsl<S>.() -> Unit)

Creates a branching test scenario from the current verified state.

Link copied to clipboard
abstract fun ref(ref: String)

Marks the current ExpectStage with a reference name for later branching.