whenCommand

fun <S : Any> GivenStage<S>.whenCommand(command: Any, header: Header = DefaultHeader.empty(), ownerId: String = OwnerId.DEFAULT_OWNER_ID): ExpectStage<S>

Extension function that allows executing a command directly from the Given stage.

This convenience method combines the given setup (with no events) and command execution in a single call, useful for testing commands on empty aggregates.

Return

an ExpectStage for defining expectations

Parameters

command

the command to execute

header

optional command header (defaults to empty)

ownerId

optional owner ID override (defaults to previously set owner)