SagaVerifier
Utility object for creating and configuring stateless saga verifiers for testing.
SagaVerifier provides a fluent API for testing stateless sagas using the Given/When/Expect pattern. It simplifies saga testing by offering pre-configured components and convenient factory methods that handle the complex setup of command gateways, service providers, and message factories.
Key features:
Pre-configured command gateway for isolated testing
Automatic metadata extraction from saga class annotations
Support for dependency injection via ServiceProvider
Fluent DSL for defining test scenarios with domain events
Type-safe testing with generics and reified types
Example usage:
SagaVerifier.sagaVerifier<OrderSaga>()
.whenEvent(mockOrderCreatedEvent)
.expectNoCommand()
.verify()Author
ahoo wang
Functions
Creates a default command gateway configured for stateless saga testing.
Creates a when stage for testing a stateless saga using reified generics.
Creates a when stage for testing a stateless saga of this class type.