@InjectSpy annotation

This annotation allows you to inject spies in your application.

Spy allows you to mixed real objects and mocks.

Example

For example, @InjectSpy can be used in the following example:

@QuarkusTest
class InjectionMockTest {

    @InjectSpy
    private lateinit var firstService: FirstService

    @Test
    fun `should respond test`() {
        assertThat(firstService.greet()).isEqualTo("Hello")
    }

    @Test
    fun `should respond second`() {
        every { firstService.greet() } returns "mock response"
        assertThat(firstService.greet()).isEqualTo("mock response")
        verify { firstService.greet() }
    }
}