aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java11
-rw-r--r--src/test/java/at/gv/egiz/moazs/DeliveryRequestAugmenterTest.java12
2 files changed, 16 insertions, 7 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java b/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
index 95cccd1..3157447 100644
--- a/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
+++ b/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
@@ -1,5 +1,6 @@
package at.gv.egiz.moazs;
+import at.gv.egiz.moazs.mzs.MzsValidator;
import at.gv.egiz.moazs.preprocess.*;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -24,6 +25,9 @@ public class ConfigProfileGeneratorTest {
private ConfigUtil util;
@Mock
+ private MzsValidator validator;
+
+ @Mock
private SpringPropertiesFacade properties;
@Test
@@ -87,7 +91,7 @@ public class ConfigProfileGeneratorTest {
public void cancelAtIncompleteDefaultProfile() {
var propMap = Map.of(PREFIX + "." + DEFAULT + ".property-a", "value-a");
var generator = setupMocksAndBuilder(propMap).build();
- when(util.isComplete(any())).thenReturn(false);
+ when(validator.isConfigProfileComplete(any())).thenReturn(false);
generator.generate();
}
@@ -96,7 +100,7 @@ public class ConfigProfileGeneratorTest {
public void continueAtIncompleteDefaultWhenVerificationDisabled() {
var propMap = Map.of(PREFIX + "." + DEFAULT + ".property-a", "value-a");
- when(util.isComplete(any())).thenReturn(false);
+ when(validator.isConfigProfileComplete(any())).thenReturn(false);
var generator = setupMocksAndBuilder(propMap)
.withVerifyCompletenessOfDefaultConfiguration(false)
@@ -112,14 +116,15 @@ public class ConfigProfileGeneratorTest {
when(properties.getPropertyNames()).thenReturn(propMap.keySet().stream());
when(properties.getProperty(any())).thenAnswer(i -> propMap.get(i.getArgument(0)));
when(util.merge(any(), any())).thenAnswer(i -> i.getArgument(0));
- when(util.isComplete(any())).thenReturn(true);
when(util.convert(any())).thenReturn(configTypeBuilder().build());
+ when(validator.isConfigProfileComplete(any())).thenReturn(true);
return configProfileGeneratorBuilder()
.withProperties(properties)
.withConfigUtil(util)
.withDefaultConfigKey(DEFAULT)
.withProfilePrefix(PREFIX)
+ .withValidator(validator)
.withVerifyCompletenessOfDefaultConfiguration(true);
}
diff --git a/src/test/java/at/gv/egiz/moazs/DeliveryRequestAugmenterTest.java b/src/test/java/at/gv/egiz/moazs/DeliveryRequestAugmenterTest.java
index 4bd64ef..424dce1 100644
--- a/src/test/java/at/gv/egiz/moazs/DeliveryRequestAugmenterTest.java
+++ b/src/test/java/at/gv/egiz/moazs/DeliveryRequestAugmenterTest.java
@@ -1,5 +1,6 @@
package at.gv.egiz.moazs;
+import at.gv.egiz.moazs.mzs.MzsValidator;
import at.gv.egiz.moazs.preprocess.ConfigUtil;
import at.gv.egiz.moazs.preprocess.DeliveryRequestAugmenter;
import at.gv.zustellung.app2mzs.xsd.ConfigType;
@@ -8,7 +9,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import java.util.Map;
@@ -28,9 +28,13 @@ public class DeliveryRequestAugmenterTest {
@Mock
private ConfigUtil configUtil;
+ @Mock
+ private MzsValidator validator;
+
@Before
public void setupMock() {
- when(configUtil.isComplete(Mockito.any())).thenReturn(true);
+ when(validator.isConfigProfileComplete(any())).thenReturn(true);
+ when(validator.isTnvzComplete(any())).thenReturn(true);
when(configUtil.merge(any(), any())).thenCallRealMethod();
}
@@ -105,11 +109,11 @@ public class DeliveryRequestAugmenterTest {
}
private DeliveryRequestAugmenter createAugmenter(ConfigType fallback) {
- return new DeliveryRequestAugmenter(Map.of("default", fallback), configUtil);
+ return new DeliveryRequestAugmenter(Map.of("default", fallback), configUtil, validator);
}
private DeliveryRequestAugmenter createAugmenter(Map<String, ConfigType> profiles) {
- return new DeliveryRequestAugmenter(profiles, configUtil);
+ return new DeliveryRequestAugmenter(profiles, configUtil, validator);
}
private ConfigType createConfig(String url, Boolean performTnvz) {