ExpectStage

Defines the stage for specifying expectations after command execution in aggregate testing.

This interface extends AggregateExpecter to provide methods for validating command results and includes the verify method to execute the accumulated expectations.

Parameters

S

the type of the aggregate state

Functions

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

Applies custom expectations to the test result.

Link copied to clipboard

Expects that an error occurred during command execution.

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

Expects a specific error with detailed validation using a Consumer.

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

Expects a specific error with detailed validation.

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

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

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

Expects an error of a specific type.

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

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

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

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

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

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

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

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

Link copied to clipboard
open fun expectEventCount(expected: Int): ExpectStage<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): ExpectStage<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.

Expects specific conditions on the domain event stream.

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

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

open fun expectEventType(vararg expected: KClass<*>): ExpectStage<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>): ExpectStage<S>

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

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

Expects specific conditions on the aggregate state object.

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

Expects specific conditions on the aggregate state and metadata.

Link copied to clipboard
fun <S : Any> ExpectStage<S>.fork(displayName: String, context: AggregateDslContext<S>, verifyError: Boolean, block: ForkedVerifiedStageDsl<S>.() -> Unit): DynamicNode

Creates a forked test scenario from the current ExpectStage.

Link copied to clipboard
open fun verify(): VerifiedStage<S>

Executes all accumulated expectations and returns a verified stage.

abstract fun verify(immediately: Boolean): VerifiedStage<S>

Executes expectations based on the immediate flag.