Skip to content

Commit 8aa9bc6

Browse files
authored
Merge branch 'main' into dstu3-upgrade
2 parents d161342 + 423c8d0 commit 8aa9bc6

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/SkeletonProcessingServiceTests.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,33 @@ void When_IsEntireRcmrSkeletonCalledWithNonRcmrPayload_Expect_ReturnsFalse() thr
206206
assertFalse((Boolean) method.invoke(skeletonProcessingService, "<MCCI_IN010000UK13>"));
207207
}
208208

209+
@Test
210+
void When_IsEntireRcmrSkeletonCalledWithUk07Payload_Expect_ReturnsTrue() throws Exception {
211+
var method = SkeletonProcessingService.class.getDeclaredMethod("isEntireRcmrSkeleton", String.class);
212+
method.setAccessible(true);
213+
214+
assertTrue((Boolean) method.invoke(skeletonProcessingService, "<RCMR_IN030000UK07>"));
215+
}
216+
217+
@Test
218+
void When_SkeletonAsWholeUk07Message_Expect_InboundMessagePayloadIsNewRCMRMessage()
219+
throws TransformerException, SAXException {
220+
var inboundMessage = new InboundMessage();
221+
var attachmentLog = createSkeletonPatientAttachmentLog();
222+
var skeletonMessage = "<RCMR_IN030000UK07>" + readInboundMessagePayloadFromFile();
223+
224+
inboundMessage.setPayload(readInboundMessagePayloadFromFile());
225+
inboundMessage.setEbXML(readInboundMessageEbXmlFromFile());
226+
227+
when(attachmentHandlerService.getAttachment(any(), any())).thenReturn(skeletonMessage.getBytes(StandardCharsets.UTF_8));
228+
when(xmlParseUtilService.getStringFromDocument(any())).thenReturn(skeletonMessage);
229+
230+
var newInboundMessage =
231+
skeletonProcessingService.updateInboundMessageWithSkeleton(attachmentLog, inboundMessage, CONVERSATION_ID);
232+
233+
assertTrue(newInboundMessage.getPayload().contains("<RCMR_IN030000UK07"));
234+
}
235+
209236
@Test
210237
void When_NormalizeSkeletonXmlCalledWithXmlDeclaration_Expect_StripsDeclarationBeforeRcmrCheck() throws Exception {
211238
var normalizeMethod = SkeletonProcessingService.class.getDeclaredMethod("normalizeSkeletonXml", String.class);

0 commit comments

Comments
 (0)