aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/at/gv')
-rw-r--r--src/test/java/at/gv/egiz/moazs/DeliveryRequestBackendTest.java28
-rw-r--r--src/test/java/at/gv/egiz/moazs/TnvzHelperTest.java9
2 files changed, 14 insertions, 23 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/DeliveryRequestBackendTest.java b/src/test/java/at/gv/egiz/moazs/DeliveryRequestBackendTest.java
index ed63489..9ae0a14 100644
--- a/src/test/java/at/gv/egiz/moazs/DeliveryRequestBackendTest.java
+++ b/src/test/java/at/gv/egiz/moazs/DeliveryRequestBackendTest.java
@@ -20,7 +20,6 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import static at.gv.egiz.moazs.MoaZSException.moaZSException;
-import static at.gv.egiz.moazs.MoaZSException.moaZSExceptionBuilder;
import static at.gv.egiz.moazs.scheme.RequestStatusResponse.getResponseID;
import static at.gv.zustellung.app2mzs.xsd.ClientType.clientTypeBuilder;
import static at.gv.zustellung.app2mzs.xsd.ConfigType.configTypeBuilder;
@@ -57,11 +56,11 @@ public class DeliveryRequestBackendTest {
private SignatureVerifier verifier;
- private DeliveryRequestBackend pipeline;
+ private DeliveryRequestBackend backend;
@Before
public void setup() {
- pipeline = new DeliveryRequestBackend(
+ backend = new DeliveryRequestBackend(
repository,
tnvzHelper,
converter,
@@ -74,7 +73,7 @@ public class DeliveryRequestBackendTest {
var appDeliveryID = "no-tnvz-request";
var expectedStatus = setupMocks(appDeliveryID, false);
- pipeline.accept(appDeliveryID);
+ backend.accept(appDeliveryID);
verifyZeroInteractions(tnvzHelper);
var response = repository.retrieveResponse(getResponseID(appDeliveryID)).get();
@@ -87,10 +86,10 @@ public class DeliveryRequestBackendTest {
public void rejectDeliveryWhenReceiverIsNotAddressable() {
var appDeliveryID = "not-addressable";
setupMocks(appDeliveryID, true);
- when(tnvzHelper.performQueryPersonRequest(any(), any(), any()))
- .thenThrow(buildMzsException("400", appDeliveryID));
+ when(tnvzHelper.performQueryPersonRequest(any(), any()))
+ .thenThrow(moaZSException("Not addressable", "400"));
- pipeline.accept(appDeliveryID);
+ backend.accept(appDeliveryID);
var responseID = getResponseID(appDeliveryID);
var response = repository.retrieveResponse(responseID).get();
@@ -99,7 +98,7 @@ public class DeliveryRequestBackendTest {
assertThat(actualCode).isEqualTo("400");
verifyZeroInteractions(converter);
- verify(tnvzHelper).performQueryPersonRequest(any(), any(), any());
+ verify(tnvzHelper).performQueryPersonRequest(any(), any());
}
@Test
@@ -107,7 +106,7 @@ public class DeliveryRequestBackendTest {
var appDeliveryID = "tnvz-request";
var expectedStatus = setupMocks(appDeliveryID, true);
- pipeline.accept(appDeliveryID);
+ backend.accept(appDeliveryID);
var response = repository.retrieveResponse(getResponseID(appDeliveryID)).get();
var actualStatus = (DeliveryRequestStatusType) response.getResponse();
@@ -120,7 +119,7 @@ public class DeliveryRequestBackendTest {
setupMocks(appDeliveryID, true);
doThrow(moaZSException("Signature Invalid!")).when(verifier).accept(any());
- pipeline.accept(appDeliveryID);
+ backend.accept(appDeliveryID);
var response = repository.retrieveResponse(getResponseID(appDeliveryID)).get();
var status = (DeliveryRequestStatusType) response.getResponse();
var actualCode = status.getError().getErrorInfo().getCode();
@@ -146,19 +145,12 @@ public class DeliveryRequestBackendTest {
if (tnvzRequest) {
when(clientFactory.create(any(), same(TNVZServicePort.class))).thenReturn(tnvzClient);
- when(tnvzHelper.performQueryPersonRequest(any(), any(), any())).thenReturn(identification);
+ when(tnvzHelper.performQueryPersonRequest(any(), any())).thenReturn(identification);
}
return status;
}
- private MoaZSException buildMzsException(String code, String appDeliveryID) {
- return moaZSExceptionBuilder("")
- .withErrorCode(code)
- .withAppDeliveryID(appDeliveryID)
- .build();
- }
-
private DeliveryRequestStatusType setupStatus(String appDeliveryId) {
var success = successBuilder()
diff --git a/src/test/java/at/gv/egiz/moazs/TnvzHelperTest.java b/src/test/java/at/gv/egiz/moazs/TnvzHelperTest.java
index b58002b..020e270 100644
--- a/src/test/java/at/gv/egiz/moazs/TnvzHelperTest.java
+++ b/src/test/java/at/gv/egiz/moazs/TnvzHelperTest.java
@@ -16,7 +16,6 @@ import org.mockito.junit.MockitoJUnitRunner;
import java.util.List;
-import static at.gv.egiz.moazs.MoaZSException.moaZSExceptionBuilder;
import static at.gv.zustellung.app2mzs.xsd.DeliveryRequestType.Payload.payloadBuilder;
import static at.gv.zustellung.app2mzs.xsd.DeliveryRequestType.Receiver.receiverBuilder;
import static at.gv.zustellung.app2mzs.xsd.DeliveryRequestType.Sender.senderBuilder;
@@ -62,7 +61,7 @@ public class TnvzHelperTest {
var success = tnvzSuccess(acceptedTypes, receiverId);
when(port.queryPerson(any())).thenReturn(success);
- var actual = helper.performQueryPersonRequest(deliveryRequest, port, moaZSExceptionBuilder());
+ var actual = helper.performQueryPersonRequest(deliveryRequest, port);
assertThat(actual).isEqualToComparingFieldByFieldRecursively(receiverId);
}
@@ -75,7 +74,7 @@ public class TnvzHelperTest {
var error = tnvzError("400", "Person not found.");
when(port.queryPerson(any())).thenReturn(error);
- helper.performQueryPersonRequest(deliveryRequest, port, moaZSExceptionBuilder());
+ helper.performQueryPersonRequest(deliveryRequest, port);
}
@Test(expected = MoaZSException.class)
@@ -87,7 +86,7 @@ public class TnvzHelperTest {
var success = tnvzSuccess(acceptedTypes, receiverId);
when(port.queryPerson(any())).thenReturn(success);
- helper.performQueryPersonRequest(deliveryRequest, port, moaZSExceptionBuilder());
+ helper.performQueryPersonRequest(deliveryRequest, port);
}
@Test
@@ -99,7 +98,7 @@ public class TnvzHelperTest {
var success = tnvzSuccess(acceptedTypes, receiverId);
when(port.queryPerson(any())).thenReturn(success);
- var actual = helper.performQueryPersonRequest(deliveryRequest, port, moaZSExceptionBuilder());
+ var actual = helper.performQueryPersonRequest(deliveryRequest, port);
assertThat(actual).isEqualToComparingFieldByFieldRecursively(receiverId);
}