aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/at/gv/egiz
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/at/gv/egiz')
-rw-r--r--src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java b/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
index 10670ff..1fec8ec 100644
--- a/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
+++ b/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
@@ -32,6 +32,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import java.util.Map;
import static at.gv.egiz.moazs.MoaZSException.moaZSException;
+import static at.gv.egiz.moazs.preprocess.ConfigProfileGenerator.DEFAULT_CONFIG_KEY;
import static at.gv.egiz.moazs.preprocess.ConfigProfileGenerator.configProfileGeneratorBuilder;
import static at.gv.zustellung.app2mzs.xsd.ConfigType.configTypeBuilder;
import static org.mockito.ArgumentMatchers.any;
@@ -46,7 +47,6 @@ import static org.mockito.Mockito.*;
public class ConfigProfileGeneratorTest {
private static final String PREFIX = "prefix";
- private static final String DEFAULT = "default";
@Mock
private ConfigUtil util;
@@ -60,9 +60,9 @@ public class ConfigProfileGeneratorTest {
@Test
public void assembleDefaultProfile() {
var propMap = Map.of(
- PREFIX + "." + DEFAULT + ".property-a", "value-a",
- PREFIX + "." + DEFAULT + ".property-b", "value-b",
- PREFIX + "." + DEFAULT + ".property-c", "value-c");
+ PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-a", "value-a",
+ PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-b", "value-b",
+ PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-c", "value-c");
var generator = setupMocksAndBuilder(propMap).build();
var profiles = generator.generate();
@@ -71,12 +71,12 @@ public class ConfigProfileGeneratorTest {
"property-a", "value-a",
"property-b", "value-b",
"property-c", "value-c"));
- assertThat(profiles.keySet()).containsExactlyInAnyOrder(DEFAULT);
+ assertThat(profiles.keySet()).containsExactlyInAnyOrder(DEFAULT_CONFIG_KEY);
}
@Test
public void assembleEmptyDefault() {
- var propMap = Map.of(PREFIX + "." + DEFAULT, "");
+ var propMap = Map.of(PREFIX + "." + DEFAULT_CONFIG_KEY, "");
var generator = setupMocksAndBuilder(propMap).build();
var profiles = generator.generate();
@@ -99,8 +99,8 @@ public class ConfigProfileGeneratorTest {
@Test
public void assembleMultipleProfiles() {
var propMap = Map.of(
- PREFIX + "." + DEFAULT+ ".property-a", "value-a",
- PREFIX + "." + DEFAULT+ ".property-b", "value-b",
+ PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-a", "value-a",
+ PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-b", "value-b",
PREFIX + "." + "profile-1.property-c", "value-c",
PREFIX + "." + "profile-2.property-d", "value-d");
@@ -111,12 +111,12 @@ public class ConfigProfileGeneratorTest {
verify(util).convert(Map.of("property-a", "value-a", "property-b", "value-b"));
verify(util).convert(Map.of("property-c", "value-c"));
verify(util).convert(Map.of("property-d", "value-d"));
- assertThat(profiles.keySet()).containsExactlyInAnyOrder(DEFAULT, "profile-1", "profile-2");
+ assertThat(profiles.keySet()).containsExactlyInAnyOrder(DEFAULT_CONFIG_KEY, "profile-1", "profile-2");
}
@Test(expected = MoaZSException.class)
public void cancelAtIncompleteDefaultProfile() {
- var propMap = Map.of(PREFIX + "." + DEFAULT + ".property-a", "value-a");
+ var propMap = Map.of(PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-a", "value-a");
var generator = setupMocksAndBuilder(propMap).build();
doThrow(moaZSException("Not Complete.")).when(validator).isConfigProfileComplete(any());
@@ -125,7 +125,7 @@ public class ConfigProfileGeneratorTest {
@Test
public void continueAtIncompleteDefaultWhenVerificationDisabled() {
- var propMap = Map.of(PREFIX + "." + DEFAULT + ".property-a", "value-a");
+ var propMap = Map.of(PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-a", "value-a");
doThrow(moaZSException("Not Complete.")).when(validator).isConfigProfileComplete(any());
@@ -136,7 +136,7 @@ public class ConfigProfileGeneratorTest {
var profiles = generator.generate();
verify(util).convert(Map.of("property-a", "value-a"));
- assertThat(profiles.keySet()).containsExactlyInAnyOrder(DEFAULT);
+ assertThat(profiles.keySet()).containsExactlyInAnyOrder(DEFAULT_CONFIG_KEY);
}
private ConfigProfileGenerator.ConfigProfileGeneratorBuilder setupMocksAndBuilder(Map<String, String> propMap) {
@@ -148,7 +148,6 @@ public class ConfigProfileGeneratorTest {
return configProfileGeneratorBuilder()
.withProperties(properties)
.withConfigUtil(util)
- .withDefaultConfigKey(DEFAULT)
.withProfilePrefix(PREFIX)
.withValidator(validator)
.withVerifyCompletenessOfDefaultConfiguration(true);