Skip to content

Commit d7d834f

Browse files
author
azhwani
committed
Add cleanUp
1 parent 4472ba7 commit d7d834f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

core-java-modules/core-java-io-3/src/test/java/com/baeldung/lastmodifiedfile/LastModifiedFileAppUnitTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.nio.file.Paths;
1010

1111
import org.apache.commons.io.FileUtils;
12+
import org.junit.jupiter.api.AfterAll;
1213
import org.junit.jupiter.api.BeforeAll;
1314
import org.junit.jupiter.api.Test;
1415

@@ -57,8 +58,7 @@ public void givenDirectory_whenUsingNioApi_thenFindLastModfile() throws IOExcept
5758
Path lastModPath = LastModifiedFileApp.findUsingNIOApi(SOURCEDIRECTORY);
5859

5960
assertThat(lastModPath).isNotNull();
60-
assertThat(lastModPath.toFile()
61-
.getName()).isEqualTo("file02.txt");
61+
assertThat(lastModPath.toFile().getName()).isEqualTo("file02.txt");
6262
}
6363

6464
@Test
@@ -69,4 +69,10 @@ public void givenDirectory_whenUsingApacheCommons_thenFindLastModfile() throws I
6969
assertThat(lastModFile.getName()).isEqualTo("file02.txt");
7070
}
7171

72+
@AfterAll
73+
public static void cleanUp() throws IOException {
74+
File srcDir = new File(SOURCEDIRECTORY);
75+
FileUtils.deleteDirectory(srcDir);
76+
}
77+
7278
}

0 commit comments

Comments
 (0)