Skip to content
Snippets Groups Projects
Commit 207e24ef authored by Lukas Malte Monnerjahn's avatar Lukas Malte Monnerjahn
Browse files

OZG-6239 KOP-2607 xta error codes in exceptions

parent 8348b6a4
Branches
Tags
No related merge requests found
...@@ -65,6 +65,18 @@ public class XtaConstants { ...@@ -65,6 +65,18 @@ public class XtaConstants {
public static final String SEND_MESSAGE_ACTION = XTA_ACTION_BASE + "SendMessage"; public static final String SEND_MESSAGE_ACTION = XTA_ACTION_BASE + "SendMessage";
public static final String SEND_MESSAGE_SYNC_ACTION = XTA_ACTION_BASE + "SendMessageSync"; public static final String SEND_MESSAGE_SYNC_ACTION = XTA_ACTION_BASE + "SendMessageSync";
/*
* Fehlercodes
*/
public static final String ERROR_CODE_LIST_URN = "urn:de:xta:webservice:codeliste:fehlernummer";
public static final String ERROR_CODE_LIST_VERSION = "2.0.0";
public static final String ERROR_CODE_PARAMETER_MISSING = "9020";
public static final String ERROR_CODE_PARAMETER_MISSING_DESCRIPTION = "Keine Parameter vorhanden";
public static final String ERROR_CODE_INTERNAL_TECHNICAL_PROBLEM = "9030";
public static final String ERROR_CODE_INTERNAL_TECHNICAL_PROBLEM_DESCRIPTION = "Interner Fehler beim XTA-Server bzw. XTA-Dienstleister";
public static final String ERROR_CODE_MESSAGE_ID_UNKNOWN = "9070";
public static final String ERROR_CODE_MESSAGE_ID_UNKNOWN_DESCRIPTION = "MessageID für den Account nicht bekannt";
public enum ConnectionPortType { public enum ConnectionPortType {
SEND, MSGBOX, MANAGEMENT SEND, MSGBOX, MANAGEMENT
} }
......
package de.ozgcloud.xta.test.app.server; package de.ozgcloud.xta.test.app.server;
import static de.ozgcloud.xta.test.app.model.XtaConstants.*;
import java.util.Optional; import java.util.Optional;
import genv3.de.xoev.transport.xta.x211.*;
import jakarta.jws.WebService; import jakarta.jws.WebService;
import org.apache.cxf.annotations.SchemaValidation; import org.apache.cxf.annotations.SchemaValidation;
...@@ -16,10 +19,7 @@ import de.ozgcloud.xta.test.app.mapper.ResponseMapper; ...@@ -16,10 +19,7 @@ import de.ozgcloud.xta.test.app.mapper.ResponseMapper;
import de.ozgcloud.xta.test.app.service.XtaMessageService; import de.ozgcloud.xta.test.app.service.XtaMessageService;
import de.ozgcloud.xta.test.app.service.XtaParameter; import de.ozgcloud.xta.test.app.service.XtaParameter;
import de.ozgcloud.xta.test.app.util.XtaIdGenerator; import de.ozgcloud.xta.test.app.util.XtaIdGenerator;
import genv3.de.xoev.transport.xta.x211.InvalidMessageIDException;
import genv3.de.xoev.transport.xta.x211.MsgBoxPortType;
import genv3.de.xoev.transport.xta.x211.PermissionDeniedException;
import genv3.de.xoev.transport.xta.x211.XTAWSTechnicalProblemException;
import genv3.eu.osci.ws.x2008.x05.transport.MsgBoxFetchRequest; import genv3.eu.osci.ws.x2008.x05.transport.MsgBoxFetchRequest;
import genv3.eu.osci.ws.x2008.x05.transport.MsgBoxResponseType; import genv3.eu.osci.ws.x2008.x05.transport.MsgBoxResponseType;
import genv3.eu.osci.ws.x2008.x05.transport.MsgBoxStatusListRequestType; import genv3.eu.osci.ws.x2008.x05.transport.MsgBoxStatusListRequestType;
...@@ -72,7 +72,7 @@ public class MsgBoxPortImpl implements MsgBoxPortType { ...@@ -72,7 +72,7 @@ public class MsgBoxPortImpl implements MsgBoxPortType {
private void validateFetchRequest(MsgBoxFetchRequest fetchRequest) throws XTAWSTechnicalProblemException { private void validateFetchRequest(MsgBoxFetchRequest fetchRequest) throws XTAWSTechnicalProblemException {
if (!(checkMessageSelectionSupported(fetchRequest.getMsgSelector()) if (!(checkMessageSelectionSupported(fetchRequest.getMsgSelector())
&& validator.isListSizeEquals(fetchRequest.getMsgSelector().getMessageID(), 1, "MessageID"))) { && validator.isListSizeEquals(fetchRequest.getMsgSelector().getMessageID(), 1, "MessageID"))) {
throw new XTAWSTechnicalProblemException("Invalid fetch request"); throw buildTechnicalProblemException("Invalid fetch request");
} }
} }
...@@ -90,7 +90,7 @@ public class MsgBoxPortImpl implements MsgBoxPortType { ...@@ -90,7 +90,7 @@ public class MsgBoxPortImpl implements MsgBoxPortType {
private XtaMessage getXtaMessageOrThrow(String messageId) throws InvalidMessageIDException { private XtaMessage getXtaMessageOrThrow(String messageId) throws InvalidMessageIDException {
Optional<XtaMessage> message = messageService.getMessage(messageId); Optional<XtaMessage> message = messageService.getMessage(messageId);
if (message.isEmpty()) { if (message.isEmpty()) {
throw new InvalidMessageIDException("No message with messageID \"" + messageId + "\" available."); throw buildInvalidMessageIDException("No message with messageID \"" + messageId + "\" available.");
} }
return message.get(); return message.get();
} }
...@@ -133,7 +133,7 @@ public class MsgBoxPortImpl implements MsgBoxPortType { ...@@ -133,7 +133,7 @@ public class MsgBoxPortImpl implements MsgBoxPortType {
validator.isNotNull(statusListRequest.getListForm(), "listForm") validator.isNotNull(statusListRequest.getListForm(), "listForm")
&& statusListRequest.getListForm().equalsIgnoreCase("MessageMetaData") && statusListRequest.getListForm().equalsIgnoreCase("MessageMetaData")
&& validator.isNotNull(statusListRequest.getMaxListItems(), "maxListItems"))) { && validator.isNotNull(statusListRequest.getMaxListItems(), "maxListItems"))) {
throw new XTAWSTechnicalProblemException("Invalid getStatusList request"); throw buildTechnicalProblemException("Invalid getStatusList request");
} }
} }
...@@ -141,11 +141,11 @@ public class MsgBoxPortImpl implements MsgBoxPortType { ...@@ -141,11 +141,11 @@ public class MsgBoxPortImpl implements MsgBoxPortType {
try { try {
int maxListItems = statusListRequest.getMaxListItems().intValueExact(); int maxListItems = statusListRequest.getMaxListItems().intValueExact();
if (maxListItems <= 0) { if (maxListItems <= 0) {
throw new XTAWSTechnicalProblemException("Invalid maxListItems value"); throw buildTechnicalProblemException("Invalid maxListItems value");
} }
return maxListItems; return maxListItems;
} catch (ArithmeticException e) { } catch (ArithmeticException e) {
throw new XTAWSTechnicalProblemException("Invalid maxListItems value"); throw buildTechnicalProblemException("Invalid maxListItems value");
} }
} }
...@@ -209,8 +209,26 @@ public class MsgBoxPortImpl implements MsgBoxPortType { ...@@ -209,8 +209,26 @@ public class MsgBoxPortImpl implements MsgBoxPortType {
messageIdsValid &= messageService.closeMessage(messageId.getValue()); messageIdsValid &= messageService.closeMessage(messageId.getValue());
} }
if( ! messageIdsValid ) { if( ! messageIdsValid ) {
throw new InvalidMessageIDException("One or more message IDs are invalid."); throw buildInvalidMessageIDException("One or more message IDs are invalid.");
}
} }
private XTAWSTechnicalProblemException buildTechnicalProblemException(String message) {
var faultInfo = new XTAWSTechnicalProblemExceptionType();
faultInfo.getErrorCode().setCode(ERROR_CODE_INTERNAL_TECHNICAL_PROBLEM);
faultInfo.getErrorCode().setName(ERROR_CODE_INTERNAL_TECHNICAL_PROBLEM_DESCRIPTION);
faultInfo.getErrorCode().setListURI(ERROR_CODE_LIST_URN);
faultInfo.getErrorCode().setListVersionID(ERROR_CODE_LIST_VERSION);
return new XTAWSTechnicalProblemException(message, faultInfo);
}
private InvalidMessageIDException buildInvalidMessageIDException(String message) {
var faultInfo = new InvalidMessageIDExceptionType();
faultInfo.getErrorCode().setCode(ERROR_CODE_MESSAGE_ID_UNKNOWN);
faultInfo.getErrorCode().setName(ERROR_CODE_MESSAGE_ID_UNKNOWN_DESCRIPTION);
faultInfo.getErrorCode().setListURI(ERROR_CODE_LIST_URN);
faultInfo.getErrorCode().setListVersionID(ERROR_CODE_LIST_VERSION);
return new InvalidMessageIDException(message, faultInfo);
} }
} }
package de.ozgcloud.xta.test.app.server; package de.ozgcloud.xta.test.app.server;
import static de.ozgcloud.xta.test.app.model.XtaConstants.*;
import de.ozgcloud.xta.test.app.mapper.RequestMapper; import de.ozgcloud.xta.test.app.mapper.RequestMapper;
import genv3.de.xoev.transport.xta.x211.*;
import genv3.eu.osci.ws.x2014.x10.transport.MessageMetaData; import genv3.eu.osci.ws.x2014.x10.transport.MessageMetaData;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.cxf.annotations.SchemaValidation; import org.apache.cxf.annotations.SchemaValidation;
...@@ -8,14 +12,7 @@ import org.springframework.stereotype.Component; ...@@ -8,14 +12,7 @@ import org.springframework.stereotype.Component;
import de.ozgcloud.xta.test.app.service.ParameterValidatorService; import de.ozgcloud.xta.test.app.service.ParameterValidatorService;
import de.ozgcloud.xta.test.app.service.XtaMessageService; import de.ozgcloud.xta.test.app.service.XtaMessageService;
import genv3.de.xoev.transport.xta.x211.GenericContentContainer;
import genv3.de.xoev.transport.xta.x211.MessageSchemaViolationException;
import genv3.de.xoev.transport.xta.x211.MessageVirusDetectionException;
import genv3.de.xoev.transport.xta.x211.ParameterIsNotValidException;
import genv3.de.xoev.transport.xta.x211.PermissionDeniedException;
import genv3.de.xoev.transport.xta.x211.SendPortType;
import genv3.de.xoev.transport.xta.x211.SyncAsyncException;
import genv3.de.xoev.transport.xta.x211.XTAWSTechnicalProblemException;
import jakarta.jws.WebService; import jakarta.jws.WebService;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
...@@ -56,7 +53,7 @@ public class SendXtaPortImpl implements SendPortType { ...@@ -56,7 +53,7 @@ public class SendXtaPortImpl implements SendPortType {
public void validateMessageId(MessageMetaData messageMetaData) throws ParameterIsNotValidException { public void validateMessageId(MessageMetaData messageMetaData) throws ParameterIsNotValidException {
if (messageMetaData.getMsgIdentification() == null || messageMetaData.getMsgIdentification().getMessageID() == null) { if (messageMetaData.getMsgIdentification() == null || messageMetaData.getMsgIdentification().getMessageID() == null) {
throw new ParameterIsNotValidException("Message ID is missing"); throw buildParameterIsNotValidException("Message ID is missing");
} }
} }
...@@ -76,4 +73,13 @@ public class SendXtaPortImpl implements SendPortType { ...@@ -76,4 +73,13 @@ public class SendXtaPortImpl implements SendPortType {
throw new UnsupportedOperationException("sendMessageSync is not supported"); throw new UnsupportedOperationException("sendMessageSync is not supported");
} }
private ParameterIsNotValidException buildParameterIsNotValidException(String message) {
var faultInfo = new ParameterIsNotValidExceptionType();
faultInfo.getErrorCode().setCode(ERROR_CODE_PARAMETER_MISSING);
faultInfo.getErrorCode().setName(ERROR_CODE_PARAMETER_MISSING_DESCRIPTION);
faultInfo.getErrorCode().setListURI(ERROR_CODE_LIST_URN);
faultInfo.getErrorCode().setListVersionID(ERROR_CODE_LIST_VERSION);
return new ParameterIsNotValidException(message, faultInfo);
}
} }
package de.ozgcloud.xta.test.app.mapper; package de.ozgcloud.xta.test.app.mapper;
import static org.assertj.core.api.Assertions.*; import static org.assertj.core.api.Assertions.assertThat;
import java.nio.file.Files; import java.nio.file.Files;
import genv3.de.xoev.transport.xta.x211.ContentType;
import genv3.de.xoev.transport.xta.x211.GenericContentContainer;
import genv3.eu.osci.ws.x2008.x05.transport.MsgBoxFetchRequest;
import genv3.eu.osci.ws.x2008.x05.transport.MsgSelector;
import genv3.eu.osci.ws.x2014.x10.transport.MessageMetaData;
import genv3.eu.osci.ws.x2014.x10.transport.PartyIdentifierType;
import lombok.SneakyThrows;
import org.apache.cxf.ws.addressing.AttributedURIType; import org.apache.cxf.ws.addressing.AttributedURIType;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
...@@ -15,18 +22,9 @@ import de.ozgcloud.xta.test.app.factory.AttributedURITypeTestFactory; ...@@ -15,18 +22,9 @@ import de.ozgcloud.xta.test.app.factory.AttributedURITypeTestFactory;
import de.ozgcloud.xta.test.app.factory.ContentTypeTestFactory; import de.ozgcloud.xta.test.app.factory.ContentTypeTestFactory;
import de.ozgcloud.xta.test.app.factory.GenericContentContainerTestFactory; import de.ozgcloud.xta.test.app.factory.GenericContentContainerTestFactory;
import de.ozgcloud.xta.test.app.factory.MessageMetaDataTestFactory; import de.ozgcloud.xta.test.app.factory.MessageMetaDataTestFactory;
import de.ozgcloud.xta.test.app.factory.MsgBoxStatusListRequestTypeTestFactory;
import de.ozgcloud.xta.test.app.factory.QualifierTypeBusinessScenarioTestFactory; import de.ozgcloud.xta.test.app.factory.QualifierTypeBusinessScenarioTestFactory;
import de.ozgcloud.xta.test.app.model.Identifier; import de.ozgcloud.xta.test.app.model.Identifier;
import de.ozgcloud.xta.test.app.model.XtaFile; import de.ozgcloud.xta.test.app.model.XtaFile;
import genv3.de.xoev.transport.xta.x211.ContentType;
import genv3.de.xoev.transport.xta.x211.GenericContentContainer;
import genv3.eu.osci.ws.x2008.x05.transport.MsgBoxFetchRequest;
import genv3.eu.osci.ws.x2008.x05.transport.MsgBoxStatusListRequestType;
import genv3.eu.osci.ws.x2008.x05.transport.MsgSelector;
import genv3.eu.osci.ws.x2014.x10.transport.MessageMetaData;
import genv3.eu.osci.ws.x2014.x10.transport.PartyIdentifierType;
import lombok.SneakyThrows;
public class RequestMapperTest { public class RequestMapperTest {
......
...@@ -21,6 +21,7 @@ import genv3.eu.osci.ws.x2014.x10.transport.MessageMetaData; ...@@ -21,6 +21,7 @@ import genv3.eu.osci.ws.x2014.x10.transport.MessageMetaData;
import genv3.eu.osci.ws.x2014.x10.transport.PartyType; import genv3.eu.osci.ws.x2014.x10.transport.PartyType;
import jakarta.xml.ws.Holder; import jakarta.xml.ws.Holder;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.assertj.core.api.Condition;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
...@@ -107,8 +108,11 @@ public class MsgBoxPortImplTest { ...@@ -107,8 +108,11 @@ public class MsgBoxPortImplTest {
void shouldRejectRequestWithoutMessageId() { void shouldRejectRequestWithoutMessageId() {
fetchRequest.getMsgSelector().getMessageID().clear(); fetchRequest.getMsgSelector().getMessageID().clear();
assertThatExceptionOfType(XTAWSTechnicalProblemException.class).isThrownBy( assertThatExceptionOfType(XTAWSTechnicalProblemException.class).isThrownBy(
() -> msgBoxPortImpl.getMessage(fetchRequest, authorIdentifier, messageMetaDataHolder, responseHeaderHolder)); () -> msgBoxPortImpl.getMessage(fetchRequest, authorIdentifier, messageMetaDataHolder, responseHeaderHolder))
.has(technicalProblemErrorCodeCondition());
} }
@Test @Test
...@@ -116,7 +120,8 @@ public class MsgBoxPortImplTest { ...@@ -116,7 +120,8 @@ public class MsgBoxPortImplTest {
fetchRequest.getMsgSelector().getMessageID().add(AttributedURITypeTestFactory.create("urn:de:xta:messageId:extra-id")); fetchRequest.getMsgSelector().getMessageID().add(AttributedURITypeTestFactory.create("urn:de:xta:messageId:extra-id"));
assertThatExceptionOfType(XTAWSTechnicalProblemException.class).isThrownBy( assertThatExceptionOfType(XTAWSTechnicalProblemException.class).isThrownBy(
() -> msgBoxPortImpl.getMessage(fetchRequest, authorIdentifier, messageMetaDataHolder, responseHeaderHolder)); () -> msgBoxPortImpl.getMessage(fetchRequest, authorIdentifier, messageMetaDataHolder, responseHeaderHolder))
.has(technicalProblemErrorCodeCondition());
} }
@Test @Test
...@@ -124,7 +129,8 @@ public class MsgBoxPortImplTest { ...@@ -124,7 +129,8 @@ public class MsgBoxPortImplTest {
when(xtaMessageService.getMessage(MsgBoxFetchRequestTestFactory.MESSAGE_ID.getValue())).thenReturn(Optional.empty()); when(xtaMessageService.getMessage(MsgBoxFetchRequestTestFactory.MESSAGE_ID.getValue())).thenReturn(Optional.empty());
assertThatExceptionOfType(InvalidMessageIDException.class).isThrownBy( assertThatExceptionOfType(InvalidMessageIDException.class).isThrownBy(
() -> msgBoxPortImpl.getMessage(fetchRequest, authorIdentifier, messageMetaDataHolder, responseHeaderHolder)); () -> msgBoxPortImpl.getMessage(fetchRequest, authorIdentifier, messageMetaDataHolder, responseHeaderHolder))
.has(invalidMessageIDExceptionCondition());
} }
@Test @Test
...@@ -132,7 +138,8 @@ public class MsgBoxPortImplTest { ...@@ -132,7 +138,8 @@ public class MsgBoxPortImplTest {
fetchRequest.getMsgSelector().setNewEntry(false); fetchRequest.getMsgSelector().setNewEntry(false);
assertThatExceptionOfType(XTAWSTechnicalProblemException.class).isThrownBy( assertThatExceptionOfType(XTAWSTechnicalProblemException.class).isThrownBy(
() -> msgBoxPortImpl.getMessage(fetchRequest, authorIdentifier, messageMetaDataHolder, responseHeaderHolder)); () -> msgBoxPortImpl.getMessage(fetchRequest, authorIdentifier, messageMetaDataHolder, responseHeaderHolder))
.has(technicalProblemErrorCodeCondition());
} }
@Test @Test
...@@ -211,7 +218,8 @@ public class MsgBoxPortImplTest { ...@@ -211,7 +218,8 @@ public class MsgBoxPortImplTest {
statusListRequest.setListForm(null); statusListRequest.setListForm(null);
assertThatExceptionOfType(XTAWSTechnicalProblemException.class).isThrownBy( assertThatExceptionOfType(XTAWSTechnicalProblemException.class).isThrownBy(
() -> msgBoxPortImpl.getStatusList(statusListRequest, authorIdentifier, responseHeaderHolder)); () -> msgBoxPortImpl.getStatusList(statusListRequest, authorIdentifier, responseHeaderHolder))
.has(technicalProblemErrorCodeCondition());
} }
@Test @Test
...@@ -219,7 +227,8 @@ public class MsgBoxPortImplTest { ...@@ -219,7 +227,8 @@ public class MsgBoxPortImplTest {
statusListRequest.setListForm("MsgAttributeListType"); statusListRequest.setListForm("MsgAttributeListType");
assertThatExceptionOfType(XTAWSTechnicalProblemException.class).isThrownBy( assertThatExceptionOfType(XTAWSTechnicalProblemException.class).isThrownBy(
() -> msgBoxPortImpl.getStatusList(statusListRequest, authorIdentifier, responseHeaderHolder)); () -> msgBoxPortImpl.getStatusList(statusListRequest, authorIdentifier, responseHeaderHolder))
.has(technicalProblemErrorCodeCondition());
} }
@ParameterizedTest @ParameterizedTest
...@@ -229,7 +238,8 @@ public class MsgBoxPortImplTest { ...@@ -229,7 +238,8 @@ public class MsgBoxPortImplTest {
when(xtaIdGenerator.generateRequestId()).thenReturn(REQUEST_ID); when(xtaIdGenerator.generateRequestId()).thenReturn(REQUEST_ID);
assertThatExceptionOfType(XTAWSTechnicalProblemException.class).isThrownBy( assertThatExceptionOfType(XTAWSTechnicalProblemException.class).isThrownBy(
() -> msgBoxPortImpl.getStatusList(statusListRequest, authorIdentifier, responseHeaderHolder)); () -> msgBoxPortImpl.getStatusList(statusListRequest, authorIdentifier, responseHeaderHolder))
.has(technicalProblemErrorCodeCondition());
} }
@Test @Test
...@@ -303,7 +313,15 @@ public class MsgBoxPortImplTest { ...@@ -303,7 +313,15 @@ public class MsgBoxPortImplTest {
assertThatExceptionOfType(InvalidMessageIDException.class).isThrownBy( assertThatExceptionOfType(InvalidMessageIDException.class).isThrownBy(
() -> msgBoxPortImpl.close(closeRequest, authorIdentifier) () -> msgBoxPortImpl.close(closeRequest, authorIdentifier)
); ).has(invalidMessageIDExceptionCondition());
}
} }
private Condition<XTAWSTechnicalProblemException> technicalProblemErrorCodeCondition() {
return new Condition<>(e -> e.getFaultInfo().getErrorCode().getCode().equals("9030"), "error code 9030");
}
private Condition<InvalidMessageIDException> invalidMessageIDExceptionCondition() {
return new Condition<>(e -> e.getFaultInfo().getErrorCode().getCode().equals("9070"), "error code 9070 for invalid message ID");
} }
} }
...@@ -9,6 +9,7 @@ import genv3.de.xoev.transport.xta.x211.GenericContentContainer; ...@@ -9,6 +9,7 @@ import genv3.de.xoev.transport.xta.x211.GenericContentContainer;
import genv3.de.xoev.transport.xta.x211.ParameterIsNotValidException; import genv3.de.xoev.transport.xta.x211.ParameterIsNotValidException;
import genv3.eu.osci.ws.x2008.x05.transport.X509TokenContainerType; import genv3.eu.osci.ws.x2008.x05.transport.X509TokenContainerType;
import genv3.eu.osci.ws.x2014.x10.transport.MessageMetaData; import genv3.eu.osci.ws.x2014.x10.transport.MessageMetaData;
import org.assertj.core.api.Condition;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Nested;
...@@ -71,8 +72,13 @@ public class SendXtaPortImplTest { ...@@ -71,8 +72,13 @@ public class SendXtaPortImplTest {
messageMetaData.getMsgIdentification().setMessageID(null); messageMetaData.getMsgIdentification().setMessageID(null);
assertThatExceptionOfType(ParameterIsNotValidException.class).isThrownBy( assertThatExceptionOfType(ParameterIsNotValidException.class).isThrownBy(
() -> sendXtaPortImpl.sendMessage(genericContainer, messageMetaData, x509TokenContainer) () -> sendXtaPortImpl.sendMessage(genericContainer, messageMetaData, x509TokenContainer))
).withMessage("Message ID is missing"); .withMessage("Message ID is missing")
.has(parameterIsMissingExceptionCondition());
} }
} }
private Condition<ParameterIsNotValidException> parameterIsMissingExceptionCondition() {
return new Condition<>(e -> e.getFaultInfo().getErrorCode().getCode().equals("9020"), "error code 9020 for missing parameter");
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment