use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.
the class PersonFhirResourceProviderIntegrationTest method shouldReturnNotFoundWhenUpdatingNonExistentPersonAsJson.
@Test
public void shouldReturnNotFoundWhenUpdatingNonExistentPersonAsJson() 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/" + WRONG_PERSON_UUID).jsonContent(toJson(person)).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 shouldReturnNotFoundWhenDeletingNonExistentPerson.
@Test
public void shouldReturnNotFoundWhenDeletingNonExistentPerson() throws Exception {
MockHttpServletResponse response = delete("/Person/" + WRONG_PERSON_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 PractitionerFhirResourceProviderIntegrationTest method shouldReturnNotFoundWhenPractitionerNotFoundAsJson.
@Test
public void shouldReturnNotFoundWhenPractitionerNotFoundAsJson() throws Exception {
MockHttpServletResponse response = get("/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 PractitionerFhirResourceProviderIntegrationTest method shouldReturnBadRequestWhenDocumentIdDoesNotMatchPractitionerIdAsXML.
@Test
public void shouldReturnBadRequestWhenDocumentIdDoesNotMatchPractitionerIdAsXML() 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/" + PRACTITIONER_UUID).xmlContent(toXML(practitioner)).accept(FhirMediaTypes.XML).go();
assertThat(response, isBadRequest());
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 shouldReturnNotFoundWhenPractitionerNotFoundAsXML.
@Test
public void shouldReturnNotFoundWhenPractitionerNotFoundAsXML() throws Exception {
MockHttpServletResponse response = get("/Practitioner/" + WRONG_PRACTITIONER_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));
}
Aggregations