use of org.hl7.fhir.r4b.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));
}
use of org.hl7.fhir.r4b.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.r4b.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));
}
use of org.hl7.fhir.r4b.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.r4b.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.
the class PractitionerFhirResourceProviderIntegrationTest method shouldReturnNotFoundWhenUpdatingNonExistentPractitionerAsJson.
@Test
public void shouldReturnNotFoundWhenUpdatingNonExistentPractitionerAsJson() throws Exception {
// get the existing record
MockHttpServletResponse response = get("/Practitioner/" + PRACTITIONER_UUID).accept(FhirMediaTypes.JSON).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).jsonContent(toJson(practitioner)).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));
}
Aggregations