Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,33 @@ void When_IsEntireRcmrSkeletonCalledWithNonRcmrPayload_Expect_ReturnsFalse() thr
assertFalse((Boolean) method.invoke(skeletonProcessingService, "<MCCI_IN010000UK13>"));
}

@Test
void When_IsEntireRcmrSkeletonCalledWithUk07Payload_Expect_ReturnsTrue() throws Exception {
var method = SkeletonProcessingService.class.getDeclaredMethod("isEntireRcmrSkeleton", String.class);
method.setAccessible(true);

assertTrue((Boolean) method.invoke(skeletonProcessingService, "<RCMR_IN030000UK07>"));
}

@Test
void When_SkeletonAsWholeUk07Message_Expect_InboundMessagePayloadIsNewRCMRMessage()
throws TransformerException, SAXException {
var inboundMessage = new InboundMessage();
var attachmentLog = createSkeletonPatientAttachmentLog();
var skeletonMessage = "<RCMR_IN030000UK07>" + readInboundMessagePayloadFromFile();

inboundMessage.setPayload(readInboundMessagePayloadFromFile());
inboundMessage.setEbXML(readInboundMessageEbXmlFromFile());

when(attachmentHandlerService.getAttachment(any(), any())).thenReturn(skeletonMessage.getBytes(StandardCharsets.UTF_8));
when(xmlParseUtilService.getStringFromDocument(any())).thenReturn(skeletonMessage);

var newInboundMessage =
skeletonProcessingService.updateInboundMessageWithSkeleton(attachmentLog, inboundMessage, CONVERSATION_ID);

assertTrue(newInboundMessage.getPayload().contains("<RCMR_IN030000UK07"));
}

@Test
void When_NormalizeSkeletonXmlCalledWithXmlDeclaration_Expect_StripsDeclarationBeforeRcmrCheck() throws Exception {
var normalizeMethod = SkeletonProcessingService.class.getDeclaredMethod("normalizeSkeletonXml", String.class);
Expand Down
Loading