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 version 3.8+, version 3+ of quarkus-junit5-mockk should be used. If you use a version between ˋ3.0.0`, and before 3.8.0, version 2.0.0 of quarkus-junit5-mockk should be used. If you use a version between 2.8 and before 3.0.0, 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