whenEvent
Hands the commit of events on on after its history, the next version in the state they evolve it to, to each handler that reads it, as whenEvent of a StateEvent does. on is the aggregate givenAggregate gave, by default the only one; by is the class of the command that committed the events, which names the commit's command type as the model does (eshop-ordering.order.SubmitOrder), headers its request facts and operator its operator, as an aggregate's AggregateSpec.whenCommand names them.
Hands event to each handler that reads it, as its subscription would: those that name its aggregate type in aggregates, or that name none and take its state type (or StateEvent<*>), but a handler of one event type skips a commit without an event of it (ProcessorBinding.skips), as the runtime's does. A commit each of them skips is handled by none (ProcessorExpectations.expectHandledBy of no handler); one no handler reads fails, as a mistake of the test. handler names the only one to call instead, by its function name (onOrderCreated) or its subscription name (OrderSaga.onOrderCreated). expect checks what they did. An exception a handler throws fails the specification, unless expect checks it (ProcessorExpectations.expectError, ProcessorExpectations.expectRetried, ProcessorExpectations.expectParked).