From 9b001b507155fddea7494409064e3998f8f9d77e Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 3 Mar 2022 17:45:21 +0100 Subject: [PATCH] Co-authored-by: Sebastian Stenzel --- .../mountpoint/CustomMountPointChooser.java | 8 +------ .../CustomMountPointChooserTest.java | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/cryptomator/common/mountpoint/CustomMountPointChooser.java b/src/main/java/org/cryptomator/common/mountpoint/CustomMountPointChooser.java index 9cfc8652f..80c5b067b 100644 --- a/src/main/java/org/cryptomator/common/mountpoint/CustomMountPointChooser.java +++ b/src/main/java/org/cryptomator/common/mountpoint/CustomMountPointChooser.java @@ -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")); - } }; } diff --git a/src/test/java/org/cryptomator/common/mountpoint/CustomMountPointChooserTest.java b/src/test/java/org/cryptomator/common/mountpoint/CustomMountPointChooserTest.java index 2954c9355..da2e0fde0 100644 --- a/src/test/java/org/cryptomator/common/mountpoint/CustomMountPointChooserTest.java +++ b/src/test/java/org/cryptomator/common/mountpoint/CustomMountPointChooserTest.java @@ -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