|
48 | 48 | @SpringBootTest |
49 | 49 | @DirtiesContext |
50 | 50 | public class IllogicalMessageComponentTest { |
51 | | - private static final String INTERACTION_ID_PATH = "/RCMR_IN010000UK05"; |
52 | | - private static final String SUBJECT_PATH = INTERACTION_ID_PATH + "/ControlActEvent/subject"; |
53 | | - private static final String MESSAGE_HEADER_PATH = "/Envelope/Header/MessageHeader"; |
54 | | - private static final String REQUEST_ID_PATH = SUBJECT_PATH + "/EhrRequest/id/@root"; |
55 | | - private static final String NHS_NUMBER_PATH = SUBJECT_PATH + "/EhrRequest/recordTarget/patient/id/@extension"; |
56 | | - private static final String FROM_PARTY_ID_PATH = MESSAGE_HEADER_PATH + "/From/PartyId"; |
57 | | - private static final String TO_PARTY_ID_PATH = MESSAGE_HEADER_PATH + "/To/PartyId"; |
58 | | - private static final String FROM_ASID_PATH = INTERACTION_ID_PATH + "/communicationFunctionSnd/device/id/@extension"; |
59 | | - private static final String TO_ASID_PATH = INTERACTION_ID_PATH + "/communicationFunctionRcv/device/id/@extension"; |
60 | | - private static final String FROM_ODS_CODE_PATH = SUBJECT_PATH + "/EhrRequest/author/AgentOrgSDS/agentOrganizationSDS/id/@extension"; |
61 | | - private static final String TO_ODS_CODE_PATH = SUBJECT_PATH + "/EhrRequest/destination/AgentOrgSDS/agentOrganizationSDS/id/@extension"; |
62 | | - private static final String MESSAGE_ID_PATH = MESSAGE_HEADER_PATH + "/MessageData/MessageId"; |
63 | 51 | private static final String CONTINUE_REQUEST = "COPC_IN000001UK01"; |
64 | 52 | private static final String ACKNOWLEDGMENT_REQUEST = "MCCI_IN010000UK13"; |
65 | | - private static final String ACTION_PATH = "/Envelope/Header/MessageHeader/Action"; |
66 | | - private static final String CONVERSATION_ID_PATH = "/Envelope/Header/MessageHeader/ConversationId"; |
67 | 53 | private static final String NON_EXISTING_CONVERSATION_ID = "d3746650-096e-414b-92a4-146ceaf74f0e"; |
68 | 54 | private static final XPathService SERVICE = new XPathService(); |
69 | 55 |
|
@@ -221,32 +207,6 @@ public void When_UnsupportedMessageSent_Expect_ErrorThrown() { |
221 | 207 | verify(taskDispatcher, never()).createTask(any()); |
222 | 208 | } |
223 | 209 |
|
224 | | - @SneakyThrows |
225 | | - private void mockEhrRequest(String ebxml, String payload, String interactionId, String conversationId) { |
226 | | - String incomingMessage = null; |
227 | | - when(objectMapper.readValue(incomingMessage, InboundMessage.class)).thenReturn(inboundMessage); |
228 | | - when(inboundMessage.getEbXML()).thenReturn(ebxml); |
229 | | - when(inboundMessage.getPayload()).thenReturn(payload); |
230 | | - |
231 | | - var ebxmlDocument = SERVICE.parseDocumentFromXml(ebxml); |
232 | | - when(xPathService.parseDocumentFromXml(inboundMessage.getEbXML())).thenReturn(ebxmlDocument); |
233 | | - var payloadDocument = SERVICE.parseDocumentFromXml(payload); |
234 | | - when(xPathService.parseDocumentFromXml(inboundMessage.getPayload())).thenReturn(payloadDocument); |
235 | | - |
236 | | - when(xPathService.getNodeValue(ebxmlDocument, ACTION_PATH)).thenReturn(interactionId); |
237 | | - when(xPathService.getNodeValue(ebxmlDocument, CONVERSATION_ID_PATH)).thenReturn(conversationId); |
238 | | - |
239 | | - when(xPathService.getNodeValue(payloadDocument, REQUEST_ID_PATH)).thenReturn("123"); |
240 | | - when(xPathService.getNodeValue(payloadDocument, NHS_NUMBER_PATH)).thenReturn("123"); |
241 | | - when(xPathService.getNodeValue(ebxmlDocument, FROM_PARTY_ID_PATH)).thenReturn("123"); |
242 | | - when(xPathService.getNodeValue(ebxmlDocument, TO_PARTY_ID_PATH)).thenReturn("123"); |
243 | | - when(xPathService.getNodeValue(payloadDocument, FROM_ASID_PATH)).thenReturn("123"); |
244 | | - when(xPathService.getNodeValue(payloadDocument, TO_ASID_PATH)).thenReturn("123"); |
245 | | - when(xPathService.getNodeValue(payloadDocument, FROM_ODS_CODE_PATH)).thenReturn("123"); |
246 | | - when(xPathService.getNodeValue(payloadDocument, TO_ODS_CODE_PATH)).thenReturn("123"); |
247 | | - when(xPathService.getNodeValue(ebxmlDocument, MESSAGE_ID_PATH)).thenReturn("123"); |
248 | | - } |
249 | | - |
250 | 210 | private static String asString(Resource resource) { |
251 | 211 | try (Reader reader = new InputStreamReader(resource.getInputStream(), UTF_8)) { |
252 | 212 | return FileCopyUtils.copyToString(reader); |
|
0 commit comments