Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
update test to reflect desired behavior of copying broken symlinks
  • Loading branch information
elharo committed Jan 14, 2024
commit cff71772686033d97acd9fa2ecb4a92aa2d8acc0
11 changes: 5 additions & 6 deletions src/test/java/org/apache/commons/io/FileUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -783,12 +783,11 @@ public void testCopyDirectory_brokenSymLink() throws IOException {

// Now copy sourceDirectory, including the broken link, to another directory
final File destination = new File(tempDirFile, "destination");
final FileNotFoundException thrown = assertThrows(
FileNotFoundException.class,
() -> FileUtils.copyDirectory(sourceDirectory, destination),
"ignored broken link"
);
assertTrue(thrown.getMessage().contains("linkfile' does not exist"));
FileUtils.copyDirectory(sourceDirectory, destination);
assertTrue(destination.exists());
File copiedBrokenSymlink = new File(destination, "linkfile");
assertTrue(Files.isSymbolicLink(copiedBrokenSymlink.toPath()));
assertFalse(Files.exists(copiedBrokenSymlink.toPath()));
}

@Test
Expand Down