final clean up

This commit is contained in:
Armin Schrenk
2023-06-30 11:57:09 +02:00
parent 8c3ede0d2a
commit 29d63a0a83
2 changed files with 5 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
package org.cryptomator.common;
import org.jetbrains.annotations.VisibleForTesting;
import org.slf4j.LoggerFactory;
import java.util.Map;
@@ -33,7 +34,7 @@ public class SubstitutingProperties extends PropertiesDecorator {
return result != null ? result : defaultValue;
}
//visible for testing
@VisibleForTesting
String process(String value) {
return TEMPLATE.matcher(value).replaceAll(match -> //
switch (match.group(1)) {

View File

@@ -30,7 +30,7 @@ public class SubstitutingPropertiesTest {
public void test(String propertyValue, String expected) {
SubstitutingProperties inTest = new SubstitutingProperties(Mockito.mock(Properties.class), Map.of("APPDIR", "foobar"));
var result = inTest.process(propertyValue);
Assertions.assertEquals(result, expected);
Assertions.assertEquals(expected, result);
}
@Test
@@ -41,7 +41,7 @@ public class SubstitutingPropertiesTest {
inTest = new SubstitutingProperties(props, Map.of());
var result = inTest.process("@{userhome}");
Assertions.assertEquals(result, "OneUponABit");
Assertions.assertEquals("OneUponABit", result);
}
@DisplayName("Other keywords are replaced accordingly")
@@ -50,7 +50,7 @@ public class SubstitutingPropertiesTest {
public void testEnvSubstitutions(String token, String envName, String expected) {
inTest = new SubstitutingProperties(new Properties(), Map.of(envName, expected));
var result = inTest.process("@{" + token + "}");
Assertions.assertEquals(result, expected);
Assertions.assertEquals(expected, result);
}
}