use of org.hl7.fhir.dstu3.model.ProcedureRequest in project openmrs-module-fhir2 by openmrs.
the class ProcedureRequestFhirResourceProviderTest method updateProcedureRequest_shouldThrowMethodNotAllowedIfDoesNotExist.
@Test(expected = MethodNotAllowedException.class)
public void updateProcedureRequest_shouldThrowMethodNotAllowedIfDoesNotExist() {
ServiceRequest wrongServiceRequest = new ServiceRequest();
wrongServiceRequest.setId(WRONG_SERVICE_REQUEST_UUID);
when(serviceRequestService.update(eq(WRONG_SERVICE_REQUEST_UUID), any(ServiceRequest.class))).thenThrow(MethodNotAllowedException.class);
resourceProvider.updateProcedureRequest(new IdType().setValue(WRONG_SERVICE_REQUEST_UUID), (ProcedureRequest) VersionConvertor_30_40.convertResource(wrongServiceRequest, false));
}
use of org.hl7.fhir.dstu3.model.ProcedureRequest in project openmrs-module-fhir2 by openmrs.
the class ProcedureRequestFhirResourceProviderTest method getServiceRequestById_shouldReturnServiceRequest.
@Test
public void getServiceRequestById_shouldReturnServiceRequest() {
IdType id = new IdType();
id.setValue(SERVICE_REQUEST_UUID);
when(serviceRequestService.get(SERVICE_REQUEST_UUID)).thenReturn(serviceRequest);
ProcedureRequest result = resourceProvider.getProcedureRequestById(id);
assertThat(result.isResource(), is(true));
assertThat(result, notNullValue());
assertThat(result.getId(), notNullValue());
assertThat(result.getId(), equalTo(SERVICE_REQUEST_UUID));
}
use of org.hl7.fhir.dstu3.model.ProcedureRequest in project openmrs-module-fhir2 by openmrs.
the class ProcedureRequestFhirResourceProviderIntegrationTest method shouldReturnExistingProcedureRequestAsJson.
@Test
public void shouldReturnExistingProcedureRequestAsJson() throws Exception {
MockHttpServletResponse response = get("/ProcedureRequest/" + PROCEDURE_REQUEST_UUID).accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));
assertThat(response.getContentAsString(), notNullValue());
ProcedureRequest serviceRequest = readResponse(response);
assertThat(serviceRequest, notNullValue());
assertThat(serviceRequest.getIdElement().getIdPart(), equalTo(PROCEDURE_REQUEST_UUID));
assertThat(serviceRequest, validResource());
}
use of org.hl7.fhir.dstu3.model.ProcedureRequest in project openmrs-module-fhir2 by openmrs.
the class ProcedureRequestFhirResourceProviderWebTest method getProcedureRequestById_shouldReturnServiceRequest.
@Test
public void getProcedureRequestById_shouldReturnServiceRequest() throws Exception {
ServiceRequest serviceRequest = new ServiceRequest();
serviceRequest.setId(SERVICE_REQUEST_UUID);
when(service.get(SERVICE_REQUEST_UUID)).thenReturn(serviceRequest);
MockHttpServletResponse response = get("/ProcedureRequest/" + SERVICE_REQUEST_UUID).accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), equalTo(FhirMediaTypes.JSON.toString()));
assertThat(readResponse(response).getIdElement().getIdPart(), equalTo(SERVICE_REQUEST_UUID));
}
use of org.hl7.fhir.dstu3.model.ProcedureRequest in project openmrs-module-fhir2 by openmrs.
the class ProcedureRequestFhirResourceProviderWebTest method setup.
@Before
@Override
public void setup() throws ServletException {
resourceProvider = new ProcedureRequestFhirResourceProvider();
resourceProvider.setServiceRequestService(service);
ServiceRequest procedureRequest = new ServiceRequest();
procedureRequest.setId(SERVICE_REQUEST_UUID);
super.setup();
}
Aggregations