inject

open fun <SERVICE : Any> inject(service: SERVICE, serviceName: String = service.javaClass.toName(), serviceType: KType = service.javaClass.kotlin.defaultType): GivenStage<S>

Injects a service instance into the test context.

This method allows registering mock or test implementations of services that the aggregate depends on during command execution.

Return

this GivenStage for method chaining

Parameters

SERVICE

the type of the service

service

the service instance to inject

serviceName

the name to register the service under (auto-generated from class name by default)

serviceType

the KType of the service (auto-generated from class by default)