whenCommand

open override fun whenCommand(command: Any, header: Header, ownerId: String, block: ExpectDsl<S>.() -> Unit)

Executes a command without prior event setup.

This method allows executing a command on an aggregate that starts with no prior events or state (empty aggregate). It creates a clean slate for testing command behavior on newly created aggregates.

Parameters

command

the command object to execute on the aggregate

header

optional message header containing additional context for the command

ownerId

the owner identifier for the command execution

block

the expectation definition using ExpectDsl for result validation