use of uk.nhs.adaptors.pss.translator.mhs.model.InboundMessage in project nia-patient-switching-standard-adaptor by NHSDigital.
the class MhsQueueMessageHandlerTest method handleEhrExtractMessageWhenEhrExtractMessageHandlerThrowsErrorShouldReturnFalse.
@Test
public void handleEhrExtractMessageWhenEhrExtractMessageHandlerThrowsErrorShouldReturnFalse() throws JAXBException, JsonProcessingException, InlineAttachmentProcessingException, BundleMappingException, AttachmentNotFoundException, ParseException, SAXException {
inboundMessage = new InboundMessage();
prepareMocks(EHR_EXTRACT_INTERACTION_ID);
doThrow(new JAXBException("Nobody expects the spanish inquisition!")).when(ehrExtractMessageHandler).handleMessage(inboundMessage, CONVERSATION_ID);
boolean result = mhsQueueMessageHandler.handleMessage(message);
assertFalse(result);
verify(mdcService).applyConversationId(CONVERSATION_ID);
verifyNoInteractions(acknowledgmentMessageHandler);
}
use of uk.nhs.adaptors.pss.translator.mhs.model.InboundMessage in project nia-patient-switching-standard-adaptor by NHSDigital.
the class MhsQueueMessageHandlerTest method handleAcknowledgeMessageWithoutErrorsShouldReturnTrue.
@Test
public void handleAcknowledgeMessageWithoutErrorsShouldReturnTrue() throws SAXException {
inboundMessage = new InboundMessage();
prepareMocks(ACKNOWLEDGEMENT_INTERACTION_ID);
boolean result = mhsQueueMessageHandler.handleMessage(message);
assertTrue(result);
verify(mdcService).applyConversationId(CONVERSATION_ID);
verify(acknowledgmentMessageHandler).handleMessage(inboundMessage, CONVERSATION_ID);
verifyNoInteractions(ehrExtractMessageHandler);
}
use of uk.nhs.adaptors.pss.translator.mhs.model.InboundMessage in project nia-patient-switching-standard-adaptor by NHSDigital.
the class AcknowledgmentMessageHandlerTest method handleMessageWithAckTypeCode.
@Test
public void handleMessageWithAckTypeCode() throws SAXException {
inboundMessage = new InboundMessage();
prepareXPathServiceMocks(ACK_TYPE_CODE);
acknowledgmentMessageHandler.handleMessage(inboundMessage, CONVERSATION_ID);
verify(migrationStatusLogService).addMigrationStatusLog(EHR_EXTRACT_REQUEST_ACKNOWLEDGED, CONVERSATION_ID);
}
use of uk.nhs.adaptors.pss.translator.mhs.model.InboundMessage in project nia-patient-switching-standard-adaptor by NHSDigital.
the class AcknowledgmentMessageHandlerTest method handleMessageWithNackTypeCode.
@Test
public void handleMessageWithNackTypeCode() throws SAXException {
inboundMessage = new InboundMessage();
prepareXPathServiceMocks(NACK_TYPE_CODE);
acknowledgmentMessageHandler.handleMessage(inboundMessage, CONVERSATION_ID);
verify(migrationStatusLogService).addMigrationStatusLog(EHR_EXTRACT_REQUEST_NEGATIVE_ACK, CONVERSATION_ID);
}
use of uk.nhs.adaptors.pss.translator.mhs.model.InboundMessage in project nia-patient-switching-standard-adaptor by NHSDigital.
the class COPCMessageHandlerTest method When_CIDFragmentPartIsReceivedBeforeFragmentIndex_Expect_ShouldUploadFile.
@Test
public void When_CIDFragmentPartIsReceivedBeforeFragmentIndex_Expect_ShouldUploadFile() throws JAXBException, InlineAttachmentProcessingException, SkeletonEhrProcessingException, SAXException, AttachmentLogException, AttachmentNotFoundException, BundleMappingException, JsonProcessingException {
InboundMessage message = new InboundMessage();
prepareFragmentMocks(message);
when(patientAttachmentLogService.findAttachmentLog(MESSAGE_ID, CONVERSATION_ID)).thenReturn(null).thenReturn(buildPatientAttachmentLog("047C22B4-613F-47D3-9A72-44A1758464FB", null, true));
when(patientAttachmentLogService.findAttachmentLog("047C22B4-613F-47D3-9A72-44A1758464FB", CONVERSATION_ID)).thenReturn(buildPatientAttachmentLog("047C22B4-613F-47D3-9A72-44A1758464FB", "CBBAE92D-C7E8-4A9C-8887-F5AEBA1F8CE1", true));
// ACT
copcMessageHandler.handleMessage(message, CONVERSATION_ID);
// Assert
verify(attachmentHandlerService).storeAttachementWithoutProcessing(anyString(), anyString(), anyString(), anyString());
}
Aggregations