fork

abstract fun fork(verifyError: Boolean = false): VerifiedStage<S>

Creates a completely independent test branch context from the current state.

This method allows testing multiple command sequences from the same verified state, creating isolated copies of the aggregate and event streams.

Return

a new VerifiedStage with copied state for independent testing

Parameters

verifyError

whether to verify that an error occurred before forking


open fun fork(verifyError: Boolean = false, handle: VerifiedStage<S>.() -> Unit): VerifiedStage<S>

Creates a test branch and executes a handler function on it.

This convenience method combines forking and handling in a single call, useful for testing alternative scenarios from the same state.

Return

this VerifiedStage (not the forked one) for method chaining

Parameters

verifyError

whether to verify that an error occurred before forking

handle

a lambda function that receives the forked VerifiedStage and performs operations