Quarkus Mockk Extension

This extension allows you to inject MockK mocks in your QuarkusTest tests.

Installation

If you want to use this extension, you need to add the quarkus-junit5-mockk extension first. In your pom.xml file, add:

<dependency>
    <groupId>io.quarkiverse.mockk</groupId>
    <artifactId>quarkus-junit5-mockk</artifactId>
    <version>LATEST</version>
    <scope>test</scope>
</dependency>

Or add this in your build.gradle file:

dependencies {
    testImplementation 'io.quarkiverse.mockk:quarkus-junit5-mockk:LATEST'
}

The extension exposes two annotations:

  • @InjectMock to inject MockK mocks in your application

  • @InjectSpy to inject SpyK spies in your application

Compatibility with Quarkus

Starting with Quarkus 2.8 and above, version 1.1.0 of quarkus-junit5-mockk should be used. If you use a version before 2.7, version 1.0.1 of quarkus-junit5-mockk should be used.

Known limitations

For the moment, this library does not :

  • Support mock injection in @Nested test classes