Skip to content

Latest commit

 

History

History

junit5

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

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.