Added unit tests for MountWithinParentUtil

This commit is contained in:
JaniruTEC
2023-07-19 15:39:14 +02:00
parent 3ea6da3c6d
commit f9f8a6b357
2 changed files with 212 additions and 2 deletions

View File

@@ -70,7 +70,8 @@ public final class MountWithinParentUtil {
}
}
private static boolean removeResidualJunction(Path path) {
//visible for testing
static boolean removeResidualJunction(Path path) {
try {
if (Files.readAttributes(path, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS).isOther()) {
LOG.info("Mountpoint \"{}\" is still a junction. Deleting it.", path);
@@ -85,7 +86,8 @@ public final class MountWithinParentUtil {
}
}
private static void removeResidualHideaway(Path mountPoint, Path hideaway) throws IOException {
//visible for testing
static void removeResidualHideaway(Path mountPoint, Path hideaway) throws IOException {
checkIsHideawayDirectory(mountPoint, hideaway);
Files.delete(hideaway); //Fails if not empty
}