Annotation Type InjectMock


  • @Retention(RUNTIME)
    @Target(FIELD)
    public @interface InjectMock
    Instructs the test engine to inject a mock instance of a bean in the field of a test class.

    This annotation is supported:

    • in a io.quarkus.test.component.QuarkusComponentTest,
    • in a io.quarkus.test.QuarkusTest if quarkus-junit5-mockito is present.
    The lifecycle and configuration API of the injected mock depends on the type of test being used.

    Some test types impose additional restrictions and limitations. For example, only beans that have a client proxy may be mocked in a io.quarkus.test.junit.QuarkusTest.