DefaultGivenDsl

class DefaultGivenDsl<S : Any>(val context: AggregateDslContext<S>, val delegate: GivenStage<S>) : AbstractGivenStageDsl<S>

Default implementation of the GivenDsl interface for basic given stage operations.

This class provides a straightforward implementation that delegates all operations to the underlying GivenStage, serving as a bridge between the DSL interface and the actual test execution logic. It extends AbstractGivenStageDsl to inherit common functionality while providing a concrete implementation for the GivenDsl contract.

Parameters

S

the state type of the aggregate being tested

Constructors

Link copied to clipboard
constructor(context: AggregateDslContext<S>, delegate: GivenStage<S>)

Properties

Link copied to clipboard
open override val context: AggregateDslContext<S>

the DSL context that manages shared state across test stages

Link copied to clipboard
open override val delegate: GivenStage<S>

the underlying GivenStage that handles the actual test setup and event replay logic

Link copied to clipboard
open override val dynamicNodes: MutableList<DynamicNode>

A mutable list of dynamic test nodes that can be modified by subclasses.

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>, 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 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, ownerId: String, block: ExpectDsl<S>.() -> Unit)

Executes a command without prior event setup.