From f6283b2f7edd1326bc58f3fa9fcba9a1a9ea4d60 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 17 Mar 2021 09:12:54 +0100 Subject: [PATCH] using text blocks where applicable --- .../org/cryptomator/common/CommonsModule.java | 10 ++++++---- .../common/LicenseCheckerTest.java | 10 ++++++---- .../settings/SettingsJsonAdapterTest.java | 19 ++++++++++++------- .../recoverykey/RecoveryKeyFactoryTest.java | 16 ++++++++++------ 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/main/commons/src/main/java/org/cryptomator/common/CommonsModule.java b/main/commons/src/main/java/org/cryptomator/common/CommonsModule.java index ed278e1ab..2a0a42ecb 100644 --- a/main/commons/src/main/java/org/cryptomator/common/CommonsModule.java +++ b/main/commons/src/main/java/org/cryptomator/common/CommonsModule.java @@ -47,10 +47,12 @@ public abstract class CommonsModule { @Named("licensePublicKey") static String provideLicensePublicKey() { // in PEM format without the dash-escaped begin/end lines - return "MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQB7NfnqiZbg2KTmoflmZ71PbXru7oW" // - + "fmnV2yv3eDjlDfGruBrqz9TtXBZV/eYWt31xu1osIqaT12lKBvZ511aaAkIBeOEV" // - + "gwcBIlJr6kUw7NKzeJt7r2rrsOyQoOG2nWc/Of/NBqA3mIZRHk5Aq1YupFdD26QE" // - + "r0DzRyj4ixPIt38CQB8="; + return """ + MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQB7NfnqiZbg2KTmoflmZ71PbXru7oW\ + fmnV2yv3eDjlDfGruBrqz9TtXBZV/eYWt31xu1osIqaT12lKBvZ511aaAkIBeOEV\ + gwcBIlJr6kUw7NKzeJt7r2rrsOyQoOG2nWc/Of/NBqA3mIZRHk5Aq1YupFdD26QE\ + r0DzRyj4ixPIt38CQB8=\ + """; } @Provides diff --git a/main/commons/src/test/java/org/cryptomator/common/LicenseCheckerTest.java b/main/commons/src/test/java/org/cryptomator/common/LicenseCheckerTest.java index 6bb4befb4..066126ccf 100644 --- a/main/commons/src/test/java/org/cryptomator/common/LicenseCheckerTest.java +++ b/main/commons/src/test/java/org/cryptomator/common/LicenseCheckerTest.java @@ -9,10 +9,12 @@ import java.util.Optional; class LicenseCheckerTest { - private static final String PUBLIC_KEY = "MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBgc4HZz+/fBbC7lmEww0AO3NK9wVZ" // - + "PDZ0VEnsaUFLEYpTzb90nITtJUcPUbvOsdZIZ1Q8fnbquAYgxXL5UgHMoywAib47" // - + "6MkyyYgPk0BXZq3mq4zImTRNuaU9slj9TVJ3ScT3L1bXwVuPJDzpr5GOFpaj+WwM" // - + "Al8G7CqwoJOsW7Kddns="; + private static final String PUBLIC_KEY = """ + MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBgc4HZz+/fBbC7lmEww0AO3NK9wVZ\ + PDZ0VEnsaUFLEYpTzb90nITtJUcPUbvOsdZIZ1Q8fnbquAYgxXL5UgHMoywAib47\ + 6MkyyYgPk0BXZq3mq4zImTRNuaU9slj9TVJ3ScT3L1bXwVuPJDzpr5GOFpaj+WwM\ + Al8G7CqwoJOsW7Kddns=\ + """; private LicenseChecker licenseChecker; diff --git a/main/commons/src/test/java/org/cryptomator/common/settings/SettingsJsonAdapterTest.java b/main/commons/src/test/java/org/cryptomator/common/settings/SettingsJsonAdapterTest.java index 8d19a0d8d..a03eb1d57 100644 --- a/main/commons/src/test/java/org/cryptomator/common/settings/SettingsJsonAdapterTest.java +++ b/main/commons/src/test/java/org/cryptomator/common/settings/SettingsJsonAdapterTest.java @@ -21,13 +21,18 @@ public class SettingsJsonAdapterTest { @Test public void testDeserialize() throws IOException { - String vault1Json = "{\"id\": \"1\", \"path\": \"/vault1\", \"mountName\": \"vault1\", \"winDriveLetter\": \"X\"}"; - String vault2Json = "{\"id\": \"2\", \"path\": \"/vault2\", \"mountName\": \"vault2\", \"winDriveLetter\": \"Y\"}"; - String json = "{\"directories\": [" + vault1Json + "," + vault2Json + "]," // - + "\"checkForUpdatesEnabled\": true,"// - + "\"port\": 8080,"// - + "\"numTrayNotifications\": 42,"// - + "\"preferredVolumeImpl\": \"FUSE\"}"; + String json = """ + { + "directories": [ + {"id": "1", "path": "/vault1", "mountName": "vault1", "winDriveLetter": "X"}, + {"id": "2", "path": "/vault2", "mountName": "vault2", "winDriveLetter": "Y"} + ], + "checkForUpdatesEnabled": true, + "port": 8080, + "numTrayNotifications": 42, + "preferredVolumeImpl": "FUSE" + } + """; Settings settings = adapter.fromJson(json); diff --git a/main/ui/src/test/java/org/cryptomator/ui/recoverykey/RecoveryKeyFactoryTest.java b/main/ui/src/test/java/org/cryptomator/ui/recoverykey/RecoveryKeyFactoryTest.java index 6ca1fd891..3ea028bf2 100644 --- a/main/ui/src/test/java/org/cryptomator/ui/recoverykey/RecoveryKeyFactoryTest.java +++ b/main/ui/src/test/java/org/cryptomator/ui/recoverykey/RecoveryKeyFactoryTest.java @@ -48,18 +48,22 @@ class RecoveryKeyFactoryTest { @Test @DisplayName("validateRecoveryKey() with invalid checksum") public void testValidateValidateRecoveryKeyWithInvalidCrc() { - boolean result = inTest.validateRecoveryKey("pathway lift abuse plenty export texture gentleman landscape beyond ceiling around leaf cafe" // - + " charity border breakdown victory surely computer cat linger restrict infer crowd live computer true written amazed investor boot" // - + " depth left theory snow whereby terminal weekly reject happiness circuit partial cup wrong"); + boolean result = inTest.validateRecoveryKey(""" + pathway lift abuse plenty export texture gentleman landscape beyond ceiling around leaf cafe charity \ + border breakdown victory surely computer cat linger restrict infer crowd live computer true written amazed \ + investor boot depth left theory snow whereby terminal weekly reject happiness circuit partial cup wrong \ + """); Assertions.assertFalse(result); } @Test @DisplayName("validateRecoveryKey() with valid input") public void testValidateValidateRecoveryKeyWithValidKey() { - boolean result = inTest.validateRecoveryKey("pathway lift abuse plenty export texture gentleman landscape beyond ceiling around leaf cafe" // - + " charity border breakdown victory surely computer cat linger restrict infer crowd live computer true written amazed investor boot" // - + " depth left theory snow whereby terminal weekly reject happiness circuit partial cup ad"); + boolean result = inTest.validateRecoveryKey(""" + pathway lift abuse plenty export texture gentleman landscape beyond ceiling around leaf cafe charity \ + border breakdown victory surely computer cat linger restrict infer crowd live computer true written amazed \ + investor boot depth left theory snow whereby terminal weekly reject happiness circuit partial cup ad \ + """); Assertions.assertTrue(result); }