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;
}
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);
}
Aggregations