Annotation Type TempDir
@Beta @Retention(RUNTIME) @Target(FIELD) public @interface TempDirGenerate a temp directory for test, and delete it after test.
Alternatively, you can use it with any class that has a public constructor with a single
FileSystemFixturethis way you can use your own utility classes for file manipulation.
If the annotated field is shared, the temp directory will be shared in this spec, otherwise every iteration will have its own temp directory.
@TempDir File testFile // will inject a File @TempDir Path testPath // will inject a Path @TempDir def testPath // will inject a Path @TempDir FileSystemFixture fsFixture // will inject an instance of FileSystemFixture with the temp path injected via constructor