on

abstract fun on(serviceProvider: ServiceProvider = SimpleServiceProvider(), commandGateway: CommandGateway = defaultCommandGateway(), commandMessageFactory: CommandMessageFactory = SimpleCommandMessageFactory( validator = TestValidator, commandBuilderRewriterRegistry = SimpleCommandBuilderRewriterRegistry(), ), block: WhenDsl<T>.() -> Unit)

Defines a test scenario with optional custom components.

This method sets up the test environment and executes the provided test block that defines the "when" conditions and expectations.

Parameters

serviceProvider

The service provider for dependency injection (defaults to simple provider).

commandGateway

The command gateway for sending commands (defaults to test gateway).

commandMessageFactory

The factory for creating command messages (defaults to simple factory with test validator).

block

The test specification block that defines the scenario.