Skip to content

Commit 7a86d11

Browse files
committed
Delete temporary directory after each test
1 parent b398cc0 commit 7a86d11

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.nio.file.Files;
2424
import java.nio.file.Path;
2525

26+
import org.junit.jupiter.api.AfterEach;
2627
import org.junit.jupiter.api.BeforeEach;
2728
import org.junit.jupiter.api.io.TempDir;
2829

@@ -67,6 +68,13 @@ protected static Path createTempSymbolicLinkedRelativeDir(final Path rootDir) th
6768
*/
6869
public Path tempDirPath;
6970

71+
@AfterEach
72+
void afterEachDeleteTempDir() throws IOException {
73+
if (Files.exists(tempDirPath)) {
74+
PathUtils.deleteDirectory(tempDirPath);
75+
}
76+
}
77+
7078
@BeforeEach
7179
public void beforeEachCreateTempDirs() throws IOException {
7280
tempDirPath = Files.createTempDirectory(managedTempDirPath, getClass().getSimpleName());

0 commit comments

Comments
 (0)