use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.
the class PractitionerFhirResourceProviderIntegrationTest method shouldReturnNotFoundWhenUpdatingNonExistentPractitionerAsXML.
@Test
public void shouldReturnNotFoundWhenUpdatingNonExistentPractitionerAsXML() throws Exception {
// get the existing record
MockHttpServletResponse response = get("/Practitioner/" + PRACTITIONER_UUID).accept(FhirMediaTypes.XML).go();
Practitioner practitioner = readResponse(response);
// update the existing record
practitioner.setId(WRONG_PRACTITIONER_UUID);
// send the update to the server
response = put("/Practitioner/" + WRONG_PRACTITIONER_UUID).xmlContent(toXML(practitioner)).accept(FhirMediaTypes.XML).go();
assertThat(response, isNotFound());
assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));
assertThat(response.getContentAsString(), notNullValue());
OperationOutcome operationOutcome = readOperationOutcome(response);
assertThat(operationOutcome, notNullValue());
assertThat(operationOutcome.hasIssue(), is(true));
}
use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.
the class PractitionerFhirResourceProviderIntegrationTest method shouldReturnNotFoundWhenDeletingNonExistentPractitioner.
@Test
public void shouldReturnNotFoundWhenDeletingNonExistentPractitioner() throws Exception {
MockHttpServletResponse response = delete("/Practitioner/" + WRONG_PRACTITIONER_UUID).accept(FhirMediaTypes.JSON).go();
assertThat(response, isNotFound());
assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));
assertThat(response.getContentAsString(), notNullValue());
OperationOutcome operationOutcome = readOperationOutcome(response);
assertThat(operationOutcome, notNullValue());
assertThat(operationOutcome.hasIssue(), is(true));
}
use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.
the class PatientFhirResourceProviderIntegrationTest method shouldReturnNotFoundWhenPatientNotFoundAsXML.
@Test
public void shouldReturnNotFoundWhenPatientNotFoundAsXML() throws Exception {
MockHttpServletResponse response = get("/Patient/" + WRONG_PATIENT_UUID).accept(FhirMediaTypes.XML).go();
assertThat(response, isNotFound());
assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));
assertThat(response.getContentAsString(), notNullValue());
OperationOutcome operationOutcome = readOperationOutcome(response);
assertThat(operationOutcome, notNullValue());
assertThat(operationOutcome.hasIssue(), is(true));
}
use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.
the class PatientFhirResourceProviderIntegrationTest method shouldReturnNotFoundWhenUpdatingNonExistentPatientAsJson.
@Test
public void shouldReturnNotFoundWhenUpdatingNonExistentPatientAsJson() throws Exception {
// get the existing record
MockHttpServletResponse response = get("/Patient/" + PATIENT_UUID).accept(FhirMediaTypes.JSON).go();
Patient patient = readResponse(response);
// update the existing record
patient.setId(WRONG_PATIENT_UUID);
// send the update to the server
response = put("/Patient/" + WRONG_PATIENT_UUID).jsonContent(toJson(patient)).accept(FhirMediaTypes.JSON).go();
assertThat(response, isNotFound());
assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));
assertThat(response.getContentAsString(), notNullValue());
OperationOutcome operationOutcome = readOperationOutcome(response);
assertThat(operationOutcome, notNullValue());
assertThat(operationOutcome.hasIssue(), is(true));
}
use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.
the class PersonFhirResourceProviderIntegrationTest method shouldReturnBadRequestWhenDocumentIdDoesNotMatchPersonIdAsJson.
@Test
public void shouldReturnBadRequestWhenDocumentIdDoesNotMatchPersonIdAsJson() throws Exception {
// get the existing record
MockHttpServletResponse response = get("/Person/" + PERSON_UUID).accept(FhirMediaTypes.JSON).go();
Person person = readResponse(response);
// update the existing record
person.setId(WRONG_PERSON_UUID);
// send the update to the server
response = put("/Person/" + PERSON_UUID).jsonContent(toJson(person)).accept(FhirMediaTypes.JSON).go();
assertThat(response, isBadRequest());
assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));
assertThat(response.getContentAsString(), notNullValue());
OperationOutcome operationOutcome = readOperationOutcome(response);
assertThat(operationOutcome, notNullValue());
assertThat(operationOutcome.hasIssue(), is(true));
}
Aggregations