MockK Patterns for JUnit 5
Artifacts are hosted on the Maven Central repository.
repositories {
mavenCentral()
}
dependencies {
testImplementation("com.github.erikhuizinga:mockk-junit5:$LATEST_VERSION")
}
See the JUnit 5 user guide to learn more about registering extensions.
Apply this Extension
to automatically apply MockkClearExtension
and MockkUnmockExtension
.
These extensions clear all MockK mocks after every unit test and unmock all MockK mocks after the test class.
Apply this Extension
to clear all Mockk mocks after each unit test.
Apply this Extension
to unmock all Mockk mocks after the test class.
Take a look at ExampleTestSuite for an example to use MockkClearUnmockExtension
with an extensive description of the involved MockK and JUnit 5 mechanics.