Class TemporaryDirectory

java.lang.Object
org.junitpioneer.jupiter.resource.TemporaryDirectory
All Implemented Interfaces:
org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource, ResourceFactory<Path>

public final class TemporaryDirectory extends Object implements ResourceFactory<Path>
TemporaryDirectory is a "resource factory" implementation that, combined with @New or @Shared, allows for the creation of temporary directories that can be used by individual tests or shared across multiple tests.

When used with the @New annotation and the annotation's arguments field is populated, the first argument will be used as the prefix of the name of the temporary directory.

It is part of the "resources" JUnit Jupiter extension, which pertains to anything that needs to be injected into tests and which may need to be started up or torn down. Temporary directories are a common example.

This class is intended for users.

For more details and examples, see the documentation on resources and temporary directories.

Since:
1.9.0
See Also:
  • Constructor Details

    • TemporaryDirectory

      public TemporaryDirectory()
  • Method Details