Saga test command handler send returns null

According to the CommandGateway sendAndWait, if null is returned that means the action timed out.

In my Saga I added a check for a null response that throws an exception, with the intent of forcing a retry of the event.

I now was trying to write a unit test for the saga but it seems the registered command gateway always returns null which triggers my check and throws the exception.

What is the proper way of doing this?

My command send function (used in Sagas):

fun <T : Any> sendCommandAndWait(command: T, eventName: String) {
        try {
            val result = commandGateway.sendAndWait<T>(command)

            if (result === null) {
                throw SagaEventHandlingTimedOut(this.javaClass.simpleName, eventName)
            }
        } catch (exception: SagaEventHandlingTimedOut) {
            log.warn("${exception.javaClass.simpleName}: ${exception.message}")

            throw exception
        } catch (exception: Throwable) {
            var cause: Throwable? = exception

            do {
                log.error("${cause?.javaClass?.simpleName}: ${cause?.message}")

                cause = exception.cause
            } while (cause != null)

            throw exception
        }
    }

My test:

@ExtendWith(MockKExtension::class)
class LedgerLifecycleSagaTest {
    private lateinit var fixture: FixtureConfiguration
    private val accountId = AccountId.fromString("c5be2bf8-4ffa-4b3e-a152-518cec206b1d")
    private val name = "Bcp mumia"
    private val balance = Money(BigDecimal.valueOf(13.00), EUR)
    private val date = Date.fromString("2014-01-02")
    private val ledgerId = LedgerId(
        accountId = accountId,
        month = date.month(),
        year = date.year(),
    )

    @MockK
    lateinit var commandBus: CommandBus

    @BeforeEach
    fun setUpEach() {
        fixture = SagaTestFixture(LedgerLifecycleSaga::class.java)
        fixture.registerCommandGateway(CommandGateway::class.java)
    }

    @Test
    fun registerAccount() {
        fixture
            .givenNoPriorActivity()
            .whenAggregate(accountId.toString())
            .publishes(
                NewAccountRegisteredEvent(
                    accountId = accountId,
                    bankName = BCP,
                    name = name,
                    accountType = CHECKING,
                    startingBalance = balance,
                    startingBalanceDate = date,
                    currency = EUR,
                    notes = "",
                )
            )
            .expectSuccessfulHandlerExecution()
            .expectActiveSagas(0)
            .expectDispatchedCommands(
                OpenBalanceForMonthCommand(
                    ledgerId = ledgerId,
                    startBalance = balance,
                )
            )
    }
}