givenEvent

abstract fun givenEvent(event: Any, block: WhenDsl<S>.() -> Unit)

Initializes the aggregate by replaying a single domain event.

This method applies the specified event to set up the aggregate state, then continues to the command execution phase.

Parameters

event

the domain event to replay

block

the continuation block for command execution


abstract fun givenEvent(events: Array<out Any> = emptyArray(), block: WhenDsl<S>.() -> Unit)

Initializes the aggregate by replaying multiple domain events.

This method applies the specified events in order to reconstruct the aggregate state, simulating previous command executions.

Parameters

events

array of domain events to replay (empty by default)

block

the continuation block for command execution