Class TempDirDeletionStrategy.Standard
java.lang.Object
org.junit.jupiter.api.io.TempDirDeletionStrategy.Standard
- All Implemented Interfaces:
TempDirDeletionStrategy
- Enclosing interface:
TempDirDeletionStrategy
public static final class TempDirDeletionStrategy.Standard
extends Object
implements TempDirDeletionStrategy
Standard
TempDirDeletionStrategy implementation that recursively
deletes all files and directories within the temporary directory.
Symbolic and other types of links, such as junctions on Windows, are not followed. A warning is logged when deleting a link that targets a location outside the temporary directory.
If a file or directory cannot be deleted, its permissions are reset
and deletion is attempted again. If deletion still fails, the path is
scheduled for deletion on JVM exit via
File.deleteOnExit(), if it belongs to the default file
system.
- Since:
- 6.1
-
Nested Class Summary
Nested classes/interfaces inherited from interface TempDirDeletionStrategy
TempDirDeletionStrategy.DeletionException, TempDirDeletionStrategy.DeletionFailure, TempDirDeletionStrategy.DeletionResult, TempDirDeletionStrategy.IgnoreFailures, TempDirDeletionStrategy.Standard -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TempDirDeletionStrategy.StandardThe singleton instance ofStandard. -
Method Summary
Modifier and TypeMethodDescriptiondelete(Path tempDir, AnnotatedElementContext elementContext, ExtensionContext extensionContext) Delete the supplied temporary directory and all of its contents.
-
Field Details
-
INSTANCE
The singleton instance ofStandard.
-
-
Method Details
-
delete
public TempDirDeletionStrategy.DeletionResult delete(Path tempDir, AnnotatedElementContext elementContext, ExtensionContext extensionContext) throws IOException Description copied from interface:TempDirDeletionStrategyDelete the supplied temporary directory and all of its contents.Depending on the used
TempDirFactory, the suppliedPathmay or may not be associated with the default FileSystem.- Specified by:
deletein interfaceTempDirDeletionStrategy- Parameters:
tempDir- the temporary directory to delete; nevernullelementContext- the context of the field or parameter where@TempDiris declared; nevernullextensionContext- the current extension context; nevernull- Returns:
- a
TempDirDeletionStrategy.DeletionResult, potentially containing failures forPathsthat could not be deleted or no failures if deletion was successful; nevernull - Throws:
IOException- in case of general failures
-