expectEvent

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

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

This method focuses on the first event produced by command execution, allowing detailed assertions on its content, metadata, and type.

Return

the current expecter instance for method chaining

Parameters

E

the type of the event body

expected

a lambda function that receives the first DomainEvent and performs assertions

Throws

if the event stream is empty or assertions fail


open fun <E : Any> expectEvent(expected: Consumer<DomainEvent<E>>): AE

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

Java-friendly overload for expectEvent that accepts a Consumer instead of a lambda.

Return

the current expecter instance for method chaining

Parameters

E

the type of the event body

expected

a Consumer that receives the first DomainEvent and performs assertions