ref
Marks the current ExpectStage with a reference name for later branching.
This method stores the current verification state under the specified reference, allowing subsequent test scenarios to fork from this exact point using AggregateDsl.fork(ref, ...). This enables complex test flows with multiple branches diverging from the same verified aggregate state.
Example usage:
whenCommand(CreateOrderCommand(...)) {
expectEventType(OrderCreated::class)
ref("order-created") // Mark this point for later branching
expectState { /* ... */}
}
// Later in the same test class
aggregateDsl.fork("order-created", "Pay Order") {
whenCommand(PayOrderCommand(...)) {
expectEventType(OrderPaid::class)
}
}Content copied to clipboard
Parameters
ref
the unique reference name to assign to this verification point