whenEvent

open override fun whenEvent(event: Any, state: Any? = null, ownerId: String = OwnerId.DEFAULT_OWNER_ID, spaceId: SpaceId = SpaceIdCapable.DEFAULT_SPACE_ID, block: ExpectDsl<T>.() -> Unit)

Defines an event processing scenario and sets up expectations.

This method processes the given event through the saga, executes the expectation block, and creates a dynamic test container with a descriptive name that includes the event type and optional scenario name.

Parameters

event

The domain event to process.

state

Optional state to provide to state-aware saga functions.

ownerId

The owner ID for the event processing.

block

The expectation block that defines assertions on the saga results.