Skip to content

Commit 2aac010

Browse files
committed
Let JUnit manage the temporary directory tree.
- managedTempDirPath is @tempdir - No need for createTempDirectory() - For @tempdir, symbolic and other types of links, such as junctions on Windows, are not followed.
1 parent d355890 commit 2aac010

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/test/java/org/apache/commons/io/file/AbstractTempDirTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,15 @@ protected static Path createTempSymbolicLinkedRelativeDir(final Path rootDir) th
8585

8686
@AfterEach
8787
void afterEachDeleteTempDir() throws IOException {
88+
// For @TempDir, symbolic and other types of links, such as junctions on Windows, are not followed.
8889
if (Files.exists(tempDirPath)) {
8990
PathUtils.deleteDirectory(tempDirPath);
9091
}
9192
}
9293

9394
@BeforeEach
9495
public void beforeEachCreateTempDirs() throws IOException {
95-
tempDirPath = Files.createTempDirectory(managedTempDirPath, getClass().getSimpleName());
96+
tempDirPath = Files.createDirectory(managedTempDirPath.resolve(getClass().getSimpleName()));
9697
tempDirFile = tempDirPath.toFile();
9798
}
9899

0 commit comments

Comments
 (0)