Class TemporaryDirectory
java.lang.Object
org.junitpioneer.jupiter.resource.TemporaryDirectory
- All Implemented Interfaces:
org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource, 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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ResourceFactory
close
-
Constructor Details
-
TemporaryDirectory
public TemporaryDirectory()
-
-
Method Details
-
create
Description copied from interface:ResourceFactoryReturns a new resource.- Specified by:
createin interfaceResourceFactory<Path>- Parameters:
arguments- a list of strings to be used to populate or configure the resource- Throws:
Exception- if creating the resource failed
-