Skip to content

Commit f5c46b9

Browse files
FileUtilsTestCase: test directory is delete in tear down method, so remove clean up in individual tests
1 parent 46fc59f commit f5c46b9

1 file changed

Lines changed: 13 additions & 21 deletions

File tree

src/test/java/org/apache/commons/io/FileUtilsTestCase.java

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -763,23 +763,19 @@ public void testForceMkdirParent() throws Exception {
763763
// Tests with existing directory
764764
assertTrue(getTestDirectory().exists());
765765
final File testParentDir = new File(getTestDirectory(), "testForceMkdirParent");
766-
try {
767-
testParentDir.delete();
768-
assertFalse(testParentDir.exists());
769-
final File testFile = new File(testParentDir, "test.txt");
770-
assertFalse(testParentDir.exists());
771-
assertFalse(testFile.exists());
772-
// Create
773-
FileUtils.forceMkdirParent(testFile);
774-
assertTrue(testParentDir.exists());
775-
assertFalse(testFile.exists());
776-
// Again
777-
FileUtils.forceMkdirParent(testFile);
778-
assertTrue(testParentDir.exists());
779-
assertFalse(testFile.exists());
780-
} finally {
781-
testParentDir.delete();
782-
}
766+
testParentDir.delete();
767+
assertFalse(testParentDir.exists());
768+
final File testFile = new File(testParentDir, "test.txt");
769+
assertFalse(testParentDir.exists());
770+
assertFalse(testFile.exists());
771+
// Create
772+
FileUtils.forceMkdirParent(testFile);
773+
assertTrue(testParentDir.exists());
774+
assertFalse(testFile.exists());
775+
// Again
776+
FileUtils.forceMkdirParent(testFile);
777+
assertTrue(testParentDir.exists());
778+
assertFalse(testFile.exists());
783779
}
784780

785781
// sizeOfDirectory
@@ -797,7 +793,6 @@ public void testSizeOfDirectory() throws Exception {
797793

798794
// Creates file
799795
file.createNewFile();
800-
file.deleteOnExit();
801796

802797
// Existing file
803798
try {
@@ -2512,7 +2507,6 @@ public boolean renameTo(final File f) {
25122507
assertTrue("Original deleted", !src.exists());
25132508
}
25142509

2515-
25162510
@Test
25172511
public void testMoveFile_CopyDelete_Failed() throws Exception {
25182512
final File destination = new File(getTestDirectory(), "move3.txt");
@@ -2599,7 +2593,6 @@ public void testMoveFile_Errors() throws Exception {
25992593
} catch (final FileExistsException e) {
26002594
// expected
26012595
}
2602-
26032596
}
26042597

26052598
@Test
@@ -2792,7 +2785,6 @@ public void testMoveDirectory_Errors() throws Exception {
27922785
} catch (final FileExistsException e) {
27932786
// expected
27942787
}
2795-
27962788
}
27972789

27982790
@Test

0 commit comments

Comments
 (0)