Search in sources :

Example 6 with ItkReportHeader

use of uk.nhs.adaptors.oneoneone.cda.report.controller.utils.ItkReportHeader in project integration-adaptor-111 by nhsconnect.

the class ReportControllerTest method getItkReportHeader.

private ItkReportHeader getItkReportHeader() {
    ItkReportHeader header = new ItkReportHeader();
    header.setTrackingId(TRACKING_ID);
    return header;
}
Also used : ItkReportHeader(uk.nhs.adaptors.oneoneone.cda.report.controller.utils.ItkReportHeader)

Example 7 with ItkReportHeader

use of uk.nhs.adaptors.oneoneone.cda.report.controller.utils.ItkReportHeader in project integration-adaptor-111 by nhsconnect.

the class ReportControllerTest method postReportValidRequest.

@Test
public void postReportValidRequest() throws XmlException {
    when(itkResponseUtil.createSuccessResponseEntity(eq(MESSAGE_ID), anyString())).thenReturn(RESPONSE_XML);
    when(headerParserUtil.getHeaderValues(any())).thenReturn(getItkReportHeader());
    String validRequest = getValidXmlReportRequest();
    ResponseEntity<String> response = reportController.postReport(validRequest);
    ArgumentCaptor<POCDMT000002UK01ClinicalDocument1> captor = ArgumentCaptor.forClass(POCDMT000002UK01ClinicalDocument1.class);
    ArgumentCaptor<ItkReportHeader> captorHeader = ArgumentCaptor.forClass(ItkReportHeader.class);
    verify(encounterReportService).transformAndPopulateToGP(captor.capture(), eq(MESSAGE_ID), captorHeader.capture());
    POCDMT000002UK01ClinicalDocument1 clinicalDocument = captor.getValue();
    assertThat(clinicalDocument.getId().getRoot()).isEqualTo("A709A442-3CF4-476E-8377-376500E829C9");
    assertThat(clinicalDocument.getSetId().getRoot()).isEqualTo("411910CF-1A76-4330-98FE-C345DDEE5553");
    assertThat(response.getStatusCode()).isEqualTo(OK);
    assertThat(response.getBody()).isEqualTo(RESPONSE_XML);
    ItkReportHeader headerValue = captorHeader.getValue();
    assertThat(headerValue.getTrackingId()).isEqualTo(TRACKING_ID);
}
Also used : ItkReportHeader(uk.nhs.adaptors.oneoneone.cda.report.controller.utils.ItkReportHeader) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) POCDMT000002UK01ClinicalDocument1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1) Test(org.junit.jupiter.api.Test)

Aggregations

ItkReportHeader (uk.nhs.adaptors.oneoneone.cda.report.controller.utils.ItkReportHeader)7 Test (org.junit.jupiter.api.Test)5 Bundle (org.hl7.fhir.dstu3.model.Bundle)3 POCDMT000002UK01ClinicalDocument1 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1)3 BundleEntryComponent (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent)2 IParser (ca.uhn.fhir.parser.IParser)1 ArrayList (java.util.ArrayList)1 Session (javax.jms.Session)1 XmlException (org.apache.xmlbeans.XmlException)1 Coding (org.hl7.fhir.dstu3.model.Coding)1 MessageHeader (org.hl7.fhir.dstu3.model.MessageHeader)1 MessageSourceComponent (org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent)1 Reference (org.hl7.fhir.dstu3.model.Reference)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 ResponseEntity (org.springframework.http.ResponseEntity)1 MessageCreator (org.springframework.jms.core.MessageCreator)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)1 SAXException (org.xml.sax.SAXException)1 ItkXmlException (uk.nhs.adaptors.oneoneone.cda.report.controller.exceptions.ItkXmlException)1