AbstractGivenStageDsl

Abstract base class for GivenDsl implementations that provides common functionality.

This class implements the core GivenDsl interface methods and provides a foundation for concrete implementations. It handles service injection, owner ID management, and coordinates the setup of test scenarios with events or state.

Type Parameters

S

the state type of the aggregate

Inheritors

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
override var name: String

The name identifier for this test scenario. Used in dynamic test naming and reporting.

Functions

Link copied to clipboard
open override fun givenEvent(event: Any, block: WhenDsl<S>.() -> Unit)

Sets up the aggregate with a single initial event.

open override fun givenEvent(events: Array<out Any> = emptyArray(), block: WhenDsl<S>.() -> Unit)

Sets up the aggregate by replaying multiple domain events.

Link copied to clipboard
open override fun givenOwnerId(ownerId: String)

Sets the owner ID for subsequent operations.

Link copied to clipboard
open override fun givenSpaceId(spaceId: SpaceId)
Link copied to clipboard
open override fun givenState(state: S, version: Int, block: WhenDsl<S>.() -> Unit)

Sets up the aggregate with a specific initial state and version.

Link copied to clipboard
open override fun inject(inject: ServiceProvider.() -> Unit)

Injects services into the test service provider.

Link copied to clipboard
open override fun name(name: String)

Sets the name for this test scenario.

Link copied to clipboard
open override fun whenCommand(command: Any, header: Header = DefaultHeader.empty(), ownerId: String = OwnerId.DEFAULT_OWNER_ID, spaceId: SpaceId = SpaceIdCapable.DEFAULT_SPACE_ID, block: ExpectDsl<S>.() -> Unit)

Executes a command without prior event setup.