Skip to content

Overview

Jimfs JUnit Jupiter is a JUnit Jupiter extension for in-memory @TempDir directories using the Jimfs file system.

It is already possible to use Jimfs and JUnit Jupiter together to create in-memory temporary directories for testing. However, this requires integrating the Jimfs in-memory file system handling with the framework's test lifecycle callbacks, boilerplate code that users would have to implement themselves. This extension offers a smooth integration between the two so that users do not have to take care of it.

Compatibility

Jimfs JUnit Jupiter is based on JUnit Jupiter 6 and requires Java 17 or higher.

Getting Started

Jimfs JUnit Jupiter

<dependency>
  <groupId>io.github.scordio</groupId>
  <artifactId>jimfs-junit-jupiter</artifactId>
  <version>${jimfs-junit-jupiter.version}</version>
  <scope>test</scope>
</dependency>
testImplementation("io.github.scordio:jimfs-junit-jupiter:${jimfsJunitJupiterVersion}")

For instructions on how to use it with JUnit Jupiter, see the Usage section.

First-party Support

The JUnit Jupiter TempDirFactory SPI allows libraries like Jimfs to customize how temporary directories are created via the @TempDir annotation. First-party support was requested in google/jimfs#258. However, Google has not yet adopted JUnit Jupiter, and first-party support may only be provided once it does. If that happens, this project will likely be discontinued.