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

Latest commit

 

History

History
44 lines (26 loc) · 1.57 KB

README.md

File metadata and controls

44 lines (26 loc) · 1.57 KB

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.