Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Files

junit5

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Mar 20, 2020
Mar 18, 2020
Feb 16, 2021
Feb 16, 2021

Download from Maven Central

mockk-junit5

MockK Patterns for JUnit 5

Installation

Artifacts are hosted on the Maven Central repository.

Gradle Installation

repositories {
    mavenCentral()
}

dependencies {
    testImplementation("com.github.erikhuizinga:mockk-junit5:$LATEST_VERSION")
}

Usage

MockK JUnit 5 extensions

See the JUnit 5 user guide to learn more about registering extensions.

MockkClearUnmockExtension

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.

MockkClearExtension

Apply this Extension to clear all Mockk mocks after each unit test.

MockkUnmockExtension

Apply this Extension to unmock all Mockk mocks after the test class.

Example

Take a look at ExampleTestSuite for an example to use MockkClearUnmockExtension with an extensive description of the involved MockK and JUnit 5 mechanics.