File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/test/java/org/apache/commons/io Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 2323import static org .junit .jupiter .api .Assertions .assertNotNull ;
2424import static org .junit .jupiter .api .Assertions .assertNull ;
2525import static org .junit .jupiter .api .Assertions .assertSame ;
26+ import static org .junit .jupiter .api .Assertions .assertDoesNotThrow ;
2627import static org .junit .jupiter .api .Assertions .assertThrows ;
2728import static org .junit .jupiter .api .Assertions .assertThrowsExactly ;
2829import static org .junit .jupiter .api .Assertions .assertTrue ;
@@ -1547,10 +1548,24 @@ public void testDelete() throws Exception {
15471548 }
15481549
15491550 @ Test
1550- public void testDeleteDirectoryWithNonDirectory () {
1551+ public void testDeleteDirectoryFailsOnFile () {
1552+ // Fail request for a File
15511553 assertThrows (IllegalArgumentException .class , () -> FileUtils .deleteDirectory (testFile1 ));
15521554 }
15531555
1556+ @ Test
1557+ public void testDeleteDirectoryNoopIfAbsent () {
1558+ // Noop on non-existent entry
1559+ assertDoesNotThrow (() -> FileUtils .deleteDirectory (new File ("does not exist.nope" )));
1560+ }
1561+
1562+ @ Test
1563+ public void testDeleteDirectoryIsSymLink () throws IOException {
1564+ final Path symlinkedDir = createTempSymlinkedRelativeDir ();
1565+ FileUtils .deleteDirectory (symlinkedDir .toFile ());
1566+ assertFalse (Files .exists (symlinkedDir ));
1567+ }
1568+
15541569 @ Test
15551570 public void testDeleteQuietlyDir () throws IOException {
15561571 final File testDirectory = new File (tempDirFile , "testDeleteQuietlyDir" );
You can’t perform that action at this time.
0 commit comments