{"id":16926345,"url":"https://github.com/scordio/jimfs-junit-jupiter","last_synced_at":"2025-08-10T03:07:42.749Z","repository":{"id":250425172,"uuid":"834080270","full_name":"scordio/jimfs-junit-jupiter","owner":"scordio","description":"JUnit Jupiter `@TempDir` extension based on the in-memory file system Jimfs","archived":false,"fork":false,"pushed_at":"2025-08-07T14:09:50.000Z","size":126,"stargazers_count":18,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-07T16:09:46.343Z","etag":null,"topics":["hacktoberfest","java","jimfs","junit-jupiter","junit5-extension","testing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scordio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"scordio"}},"created_at":"2024-07-26T11:25:24.000Z","updated_at":"2025-08-07T14:09:53.000Z","dependencies_parsed_at":"2024-10-28T13:17:16.580Z","dependency_job_id":"47d9ee2d-e2bc-4d40-b1a1-f04d49f284f3","html_url":"https://github.com/scordio/jimfs-junit-jupiter","commit_stats":null,"previous_names":["scordio/jimfs-junit-jupiter"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/scordio/jimfs-junit-jupiter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scordio%2Fjimfs-junit-jupiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scordio%2Fjimfs-junit-jupiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scordio%2Fjimfs-junit-jupiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scordio%2Fjimfs-junit-jupiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scordio","download_url":"https://codeload.github.com/scordio/jimfs-junit-jupiter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scordio%2Fjimfs-junit-jupiter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269668887,"owners_count":24456559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","java","jimfs","junit-jupiter","junit5-extension","testing"],"created_at":"2024-10-13T20:29:39.829Z","updated_at":"2025-08-10T03:07:42.740Z","avatar_url":"https://github.com/scordio.png","language":"Java","funding_links":["https://github.com/sponsors/scordio"],"categories":[],"sub_categories":[],"readme":"# Jimfs JUnit Jupiter [![Maven Central](https://img.shields.io/maven-central/v/io.github.scordio/jimfs-junit-jupiter?label=Maven%20Central)](https://mvnrepository.com/artifact/io.github.scordio/jimfs-junit-jupiter) [![javadoc](https://javadoc.io/badge2/io.github.scordio/jimfs-junit-jupiter/javadoc.svg)](https://javadoc.io/doc/io.github.scordio/jimfs-junit-jupiter)\n\n[![CI](https://github.com/scordio/jimfs-junit-jupiter/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/scordio/jimfs-junit-jupiter/actions/workflows/main.yml?query=branch%3Amain)\n\nThis project provides a [JUnit Jupiter][] extension for in-memory\n[`@TempDir`](https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/io/TempDir.html)\ndirectories using the [Jimfs][] file system.\n\n## Getting Started\n\n### Compatibility\n\nJimfs JUnit Jupiter is based on JUnit Jupiter 5 and requires Java 8 or higher.\n\nCompatibility is guaranteed only with the JUnit Jupiter versions from\n[5.10.0](https://junit.org/junit5/docs/5.10.0/release-notes/index.html)\nto the\n[latest](https://junit.org/junit5/docs/current/release-notes/index.html).\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.github.scordio\u003c/groupId\u003e\n  \u003cartifactId\u003ejimfs-junit-jupiter\u003c/artifactId\u003e\n  \u003cversion\u003e${jimfs-junit-jupiter.version}\u003c/version\u003e\n  \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n\n```kotlin\ntestImplementation(\"io.github.scordio:jimfs-junit-jupiter:${jimfsJunitJupiterVersion}\")\n```\n\n## JimfsTempDirFactory\n\nThe simplest usage is to set the\n[`factory`](https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/io/TempDir.html#factory())\nattribute of `@TempDir` to `JimfsTempDirFactory`:\n\n```java\n@Test\nvoid test(@TempDir(factory = JimfsTempDirFactory.class) Path tempDir) {\n  assertThat(tempDir.getFileSystem().provider().getScheme()).isEqualTo(\"jimfs\");\n}\n```\n\n`tempDir` is resolved to an in-memory temporary directory based on Jimfs, configured appropriately for the current\nplatform.\n\n## @JimfsTempDir\n\n`@JimfsTempDir` is an annotation that can be used as a drop-in replacement for\n`@TempDir(factory = JimfsTempDirFactory.class)`:\n\n```java\n@Test\nvoid test(@JimfsTempDir Path tempDir) {\n  assertThat(tempDir.getFileSystem().provider().getScheme()).isEqualTo(\"jimfs\");\n}\n```\n\nThe default behavior of the annotation is equivalent to using `JimfsTempDirFactory` directly: `tempDir` is resolved to\nan in-memory temporary directory based on Jimfs, configured appropriately for the current platform.\n\nFor better control over the underlying in-memory file system, `@JimfsTempDir` offers an optional `value` attribute\nthat can be set to the desired configuration, one of:\n* `DEFAULT`: based on the corresponding [configuration parameter](#default-jimfs-configuration) (default)\n* `FOR_CURRENT_PLATFORM`: appropriate to the current platform\n* `OS_X`: for a Mac OS X-like file system\n* `UNIX`: for a UNIX-like file system\n* `WINDOWS`: for a Windows-like file system\n\nFor example, the following defines a Windows-like temporary directory, regardless of the platform on which the test is\nrunning:\n\n```java\n@Test\nvoid test(@JimfsTempDir(WINDOWS) Path tempDir) {\n  assertThat(tempDir.getFileSystem().getSeparator()).isEqualTo(\"\\\\\");\n}\n```\n\n## Configuration Parameters\n\nJimfs JUnit Jupiter supports JUnit\n[configuration parameters](https://junit.org/junit5/docs/current/user-guide/#running-tests-config-params).\n\n### Default `@TempDir` Factory\n\nThe `junit.jupiter.tempdir.factory.default` configuration parameter sets the default factory to use, expecting a fully\nqualified class name.\n\nFor example, the following configures `JimfsTempDirFactory`:\n\n```properties\njunit.jupiter.tempdir.factory.default=io.github.scordio.jimfs.junit.jupiter.JimfsTempDirFactory\n```\n\nThe factory will be used for all `@TempDir` annotations unless the annotation's `factory` attribute specifies a\ndifferent type.\n\n### Default Jimfs Configuration\n\nThe `jimfs.junit.jupiter.tempdir.configuration.default` configuration parameter sets the default Jimfs configuration to\nuse. It expects one of the following values (case-insensitive):\n* `FOR_CURRENT_PLATFORM`: appropriate to the current platform (default)\n* `OS_X`: for a Mac OS X-like file system\n* `UNIX`: for a UNIX-like file system\n* `WINDOWS`: for a Windows-like file system\n\nFor example, the following defines a Windows-like temporary directory, regardless of the platform on which the test is\nrunning:\n\n```properties\njimfs.junit.jupiter.tempdir.configuration.default=windows\n```\n\nAll Jimfs-based temporary directories will be configured accordingly unless `@JimfsTempDir` is used with\nits `value` attribute set.\n\n## Limitations\n\nJimfs JUnit Jupiter only supports annotated fields or parameters of type `Path`, since Jimfs is a non-default file\nsystem and `File` instances can only be associated with the default file system.\n\nIn addition, compared to the configuration options that Jimfs provides, Jimfs JUnit Jupiter offers a simplified\ninterface to keep usage straightforward.\n\nIn case something is missing for your use case, please [raise an issue](../../issues/new)!\n\n## Motivation\n\nIt is currently possible to use Jimfs and JUnit Jupiter together to create in-memory temporary directories for testing.\nHowever, this requires Jimfs in-memory file system handling to be integrated with JUnit Jupiter test lifecycle callbacks,\nboilerplate code that users must implement themselves.\n\nStarting from version 5.10, JUnit Jupiter offers a\n[`TempDirFactory` SPI](https://junit.org/junit5/docs/5.10.0/user-guide/#writing-tests-built-in-extensions-TempDirectory)\nfor customizing how temporary directories are created via the `@TempDir` annotation.\nThe SPI allows libraries like Jimfs to provide their own implementations.\n\nFirst-party support was requested in [google/jimfs#258](https://github.com/google/jimfs/issues/258).\nHowever, Google has not yet started using JUnit Jupiter, and first-party support may only be provided once it does.\nSince this extension was created to offer users a smooth integration between Jimfs and JUnit Jupiter, the project will\nlikely be discontinued if Google ever provides official support for this integration.\n\n## License\n\nJimfs JUnit Jupiter is released under version 2.0 of the [Apache License][].\n\n[Apache License]: https://www.apache.org/licenses/LICENSE-2.0\n[Jimfs]: https://github.com/google/jimfs\n[JUnit Jupiter]: https://github.com/junit-team/junit-framework\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscordio%2Fjimfs-junit-jupiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscordio%2Fjimfs-junit-jupiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscordio%2Fjimfs-junit-jupiter/lists"}