AggregateExpecter

Defines the interface for aggregate expectation testing in the WOW framework.

This interface provides methods to assert various aspects of aggregate behavior after command execution, including state validation, event stream verification, and error checking. It supports fluent API chaining for building comprehensive test assertions.

Parameters

S

the type of the aggregate state

AE

the self-referential type for fluent chaining (typically the implementing class)

Inheritors

Functions

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

Applies custom expectations to the test result.

Link copied to clipboard
open fun expectError(): AE

Expects that an error occurred during command execution.

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

Expects a specific error with detailed validation using a Consumer.

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

Expects a specific error with detailed validation.

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

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

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

Expects an error of a specific type.

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

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

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

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

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

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

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

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

Link copied to clipboard
open fun expectEventCount(expected: Int): AE

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): AE

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): AE

Expects specific conditions on the domain event stream.

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

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

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

Expects events of specific types in the exact order provided.

Link copied to clipboard
open fun expectNoError(): AE

Expects that no error occurred during command execution.

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

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

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

Expects specific conditions on the aggregate state object.

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

Expects specific conditions on the aggregate state and metadata.