Search in sources :

Example 1 with COPCIN000001UK01Message

use of org.hl7.v3.COPCIN000001UK01Message in project nia-patient-switching-standard-adaptor by NHSDigital.

the class NackAckPreparationServiceTest method When_SendNackMessageCOPC_WithTimeoutFailure_Expect_ShouldHaveCorrectNackCode.

@Test
public void When_SendNackMessageCOPC_WithTimeoutFailure_Expect_ShouldHaveCorrectNackCode() throws JAXBException {
    COPCIN000001UK01Message payload = unmarshallString(readSubsequentInboundMessagePayloadFromFile(), COPCIN000001UK01Message.class);
    nackAckPreparationService.sendNackMessage(NACKReason.LARGE_MESSAGE_TIMEOUT, payload, CONVERSATION_ID);
    verify(sendNACKMessageHandler).prepareAndSendMessage(ackMessageDataCaptor.capture());
    assertEquals("25", ackMessageDataCaptor.getValue().getNackCode());
}
Also used : COPCIN000001UK01Message(org.hl7.v3.COPCIN000001UK01Message) Test(org.junit.jupiter.api.Test)

Example 2 with COPCIN000001UK01Message

use of org.hl7.v3.COPCIN000001UK01Message in project nia-patient-switching-standard-adaptor by NHSDigital.

the class NackAckPreparationServiceTest method When_SendNackMessageCOPC_WithAttachmentsNotReceived_Expect_ShouldHaveCorrectNackCode.

@Test
public void When_SendNackMessageCOPC_WithAttachmentsNotReceived_Expect_ShouldHaveCorrectNackCode() throws JAXBException {
    COPCIN000001UK01Message payload = unmarshallString(readSubsequentInboundMessagePayloadFromFile(), COPCIN000001UK01Message.class);
    nackAckPreparationService.sendNackMessage(NACKReason.LARGE_MESSAGE_ATTACHMENTS_NOT_RECEIVED, payload, CONVERSATION_ID);
    verify(sendNACKMessageHandler).prepareAndSendMessage(ackMessageDataCaptor.capture());
    assertEquals("31", ackMessageDataCaptor.getValue().getNackCode());
}
Also used : COPCIN000001UK01Message(org.hl7.v3.COPCIN000001UK01Message) Test(org.junit.jupiter.api.Test)

Example 3 with COPCIN000001UK01Message

use of org.hl7.v3.COPCIN000001UK01Message in project nia-patient-switching-standard-adaptor by NHSDigital.

the class NackAckPreparationServiceTest method When_SendNackMessageCOPC_WithUnexpectedCondition_Expect_ShouldHaveCorrectNackCode.

@Test
public void When_SendNackMessageCOPC_WithUnexpectedCondition_Expect_ShouldHaveCorrectNackCode() throws JAXBException {
    COPCIN000001UK01Message payload = unmarshallString(readSubsequentInboundMessagePayloadFromFile(), COPCIN000001UK01Message.class);
    nackAckPreparationService.sendNackMessage(NACKReason.UNEXPECTED_CONDITION, payload, CONVERSATION_ID);
    verify(sendNACKMessageHandler).prepareAndSendMessage(ackMessageDataCaptor.capture());
    assertEquals("99", ackMessageDataCaptor.getValue().getNackCode());
}
Also used : COPCIN000001UK01Message(org.hl7.v3.COPCIN000001UK01Message) Test(org.junit.jupiter.api.Test)

Example 4 with COPCIN000001UK01Message

use of org.hl7.v3.COPCIN000001UK01Message in project nia-patient-switching-standard-adaptor by NHSDigital.

the class NackAckPreparationServiceTest method When_SendNackMessageCOPC_WithNoErrors_Expect_ShouldUpdateLog.

@Test
public void When_SendNackMessageCOPC_WithNoErrors_Expect_ShouldUpdateLog() throws JAXBException {
    COPCIN000001UK01Message payload = unmarshallString(readSubsequentInboundMessagePayloadFromFile(), COPCIN000001UK01Message.class);
    when(sendNACKMessageHandler.prepareAndSendMessage(any(NACKMessageData.class))).thenReturn(true);
    assertTrue(nackAckPreparationService.sendNackMessage(NACKReason.LARGE_MESSAGE_GENERAL_FAILURE, payload, CONVERSATION_ID));
    verify(migrationStatusLogService).addMigrationStatusLog(ERROR_LRG_MSG_GENERAL_FAILURE, CONVERSATION_ID);
}
Also used : NACKMessageData(uk.nhs.adaptors.pss.translator.model.NACKMessageData) COPCIN000001UK01Message(org.hl7.v3.COPCIN000001UK01Message) Test(org.junit.jupiter.api.Test)

Example 5 with COPCIN000001UK01Message

use of org.hl7.v3.COPCIN000001UK01Message in project nia-patient-switching-standard-adaptor by NHSDigital.

the class NackAckPreparationServiceTest method When_SendNackMessageCOPC_WithClinicalSysIntegrationFailure_Expect_ShouldHaveCorrectNackCode.

@Test
public void When_SendNackMessageCOPC_WithClinicalSysIntegrationFailure_Expect_ShouldHaveCorrectNackCode() throws JAXBException {
    COPCIN000001UK01Message payload = unmarshallString(readSubsequentInboundMessagePayloadFromFile(), COPCIN000001UK01Message.class);
    nackAckPreparationService.sendNackMessage(NACKReason.CLINICAL_SYSTEM_INTEGRATION_FAILURE, payload, CONVERSATION_ID);
    verify(sendNACKMessageHandler).prepareAndSendMessage(ackMessageDataCaptor.capture());
    assertEquals("11", ackMessageDataCaptor.getValue().getNackCode());
}
Also used : COPCIN000001UK01Message(org.hl7.v3.COPCIN000001UK01Message) Test(org.junit.jupiter.api.Test)

Aggregations

COPCIN000001UK01Message (org.hl7.v3.COPCIN000001UK01Message)12 Test (org.junit.jupiter.api.Test)11 NACKMessageData (uk.nhs.adaptors.pss.translator.model.NACKMessageData)3 ParseException (java.text.ParseException)1 ValidationException (javax.xml.bind.ValidationException)1 Document (org.w3c.dom.Document)1 SAXException (org.xml.sax.SAXException)1 PatientAttachmentLog (uk.nhs.adaptors.connector.model.PatientAttachmentLog)1 PatientMigrationRequest (uk.nhs.adaptors.connector.model.PatientMigrationRequest)1 InlineAttachmentProcessingException (uk.nhs.adaptors.pss.translator.exception.InlineAttachmentProcessingException)1 XmlUnmarshallUtil.unmarshallString (uk.nhs.adaptors.pss.translator.util.XmlUnmarshallUtil.unmarshallString)1