Co-authored-by: Sebastian Stenzel <overheadhunter@users.noreply.github.com>

This commit is contained in:
Armin Schrenk
2022-03-03 17:45:21 +01:00
parent 14dc026354
commit 9b001b5071
2 changed files with 13 additions and 16 deletions

View File

@@ -61,15 +61,9 @@ class CustomMountPointChooser implements MountPointChooser {
LOG.debug("Successfully checked custom mount point: {}", mountPoint);
yield false;
}
case NONE -> {
//Requirement "NONE" doesn't make any sense here.
//No need to prepare/verify a Mountpoint without requiring one...
case NONE, UNUSED_ROOT_DIR, PARENT_OPT_MOUNT_POINT -> {
throw new InvalidMountPointException(new IllegalStateException("Illegal MountPointRequirement"));
}
default -> {
//Currently the case for "UNUSED_ROOT_DIR, PARENT_OPT_MOUNT_POINT"
throw new InvalidMountPointException(new IllegalStateException("Not implemented"));
}
};
}

View File

@@ -5,7 +5,6 @@ import org.cryptomator.common.settings.VaultSettings;
import org.cryptomator.common.vaults.MountPointRequirement;
import org.cryptomator.common.vaults.Volume;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
@@ -69,8 +68,9 @@ public class CustomMountPointChooserTest {
Path hideaway = customMpc.getHideaway(mntPoint);
Assertions.assertTrue(Files.exists(hideaway));
Assumptions.assumeTrue(OS.WINDOWS.isCurrentOs());
Assertions.assertTrue((Boolean) Files.getAttribute(hideaway, "dos:hidden"));
if(OS.WINDOWS.isCurrentOs()) {
Assertions.assertTrue((Boolean) Files.getAttribute(hideaway, "dos:hidden"));
}
}
@Test
@@ -102,8 +102,9 @@ public class CustomMountPointChooserTest {
//evaluate
Assertions.assertTrue(Files.exists(hideaway));
Assumptions.assumeTrue(OS.WINDOWS.isCurrentOs());
Assertions.assertTrue((Boolean) Files.getAttribute(hideaway, "dos:hidden"));
if(OS.WINDOWS.isCurrentOs()) {
Assertions.assertTrue((Boolean) Files.getAttribute(hideaway, "dos:hidden"));
}
}
@Test
@@ -122,8 +123,9 @@ public class CustomMountPointChooserTest {
Assertions.assertTrue(Files.exists(hideaway));
Assertions.assertTrue(Files.exists(mntPoint));
Assumptions.assumeTrue(OS.WINDOWS.isCurrentOs());
Assertions.assertFalse((Boolean) Files.getAttribute(hideaway, "dos:hidden"));
if(OS.WINDOWS.isCurrentOs()) {
Assertions.assertFalse((Boolean) Files.getAttribute(hideaway, "dos:hidden"));
}
}
@Test
@@ -158,8 +160,9 @@ public class CustomMountPointChooserTest {
Assertions.assertTrue(Files.exists(mntPoint));
Assertions.assertTrue(Files.notExists(hideaway));
Assumptions.assumeTrue(OS.WINDOWS.isCurrentOs());
Assertions.assertFalse((Boolean) Files.getAttribute(mntPoint, "dos:hidden"));
if(OS.WINDOWS.isCurrentOs()) {
Assertions.assertFalse((Boolean) Files.getAttribute(mntPoint, "dos:hidden"));
}
}
@Test