Mock axon Event Store?

Hello there :slight_smile:

Is it possible to mock the EventStore for junit Tests with mockito?

class QualificationCommandHandlingTests {

    private val eventStore: EventStore = Mockito.mock(EventStore::class.java)

    private val qualificationRepository: Repository<Qualification> =
        EventSourcingRepository.builder(Qualification::class.java).eventStore(eventStore).build()

    private val fixture = AggregateTestFixture(Qualification::class.java)

    init {
        fixture.registerInjectableResource(eventStore)
        fixture.registerInjectableResource(qualificationRepository)
        fixture.registerAnnotatedCommandHandler(CreateQualificationHandler(qualificationRepository))
    }

    @Test
    fun `Test Qualification Command Handling`() {
        val uuid = UUID.randomUUID()
        val title = "New Qualification"
        fixture
            .given()
            .`when`(CreateQualification(uuid.toString(), title))
            .expectSuccessfulHandlerExecution()
            .expectEvents(QualificationCreated(uuid, title))
    }
}

Does not work, because of course does not throw any events. :slight_smile:

The whole point of the fixture is that it’s using a RecordingEventStore underneath. Can you please explain why you would want to mock the EventStore?