expectState

open fun expectState(expected: S.() -> Unit): AE

Expects specific conditions on the aggregate state object.

This method focuses on the state data itself, allowing assertions on the business state properties without access to aggregate metadata.

Return

the current expecter instance for method chaining

Parameters

expected

a lambda function that receives the state object and performs assertions


open fun expectState(expected: Consumer<S>): AE

Expects specific conditions on the aggregate state object using a Consumer.

This is a Java-friendly overload that accepts a Consumer instead of a lambda, useful when integrating with Java code or when a method reference is preferred.

Return

the current expecter instance for method chaining

Parameters

expected

a Consumer that receives the state object and performs assertions