use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.
the class GroupFhirResourceProviderIntegrationTest method shouldReturnNotFoundWhenUpdatingNonExistentGroupAsXML.
@Test
public void shouldReturnNotFoundWhenUpdatingNonExistentGroupAsXML() throws Exception {
// get the existing record
MockHttpServletResponse response = get("/Group/" + COHORT_UUID).accept(FhirMediaTypes.XML).go();
Group group = readResponse(response);
// update the existing record
group.setId(BAD_COHORT_UUID);
// send the update to the server
response = put("/Group/" + BAD_COHORT_UUID).xmlContent(toXML(group)).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 GroupFhirResourceProviderIntegrationTest method shouldReturnBadRequestWhenDocumentIdDoesNotMatchGroupIdAsXML.
@Test
public void shouldReturnBadRequestWhenDocumentIdDoesNotMatchGroupIdAsXML() throws Exception {
// get the existing record
MockHttpServletResponse response = get("/Group/" + COHORT_UUID).accept(FhirMediaTypes.XML).go();
Group group = readResponse(response);
// update the existing record
group.setId(BAD_COHORT_UUID);
// send the update to the server
response = put("/Group/" + COHORT_UUID).xmlContent(toXML(group)).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 LocationFhirResourceProviderIntegrationTest method shouldReturnNotFoundWhenDeletingNonExistentLocationAsJson.
@Test
public void shouldReturnNotFoundWhenDeletingNonExistentLocationAsJson() throws Exception {
MockHttpServletResponse response = delete("/Location/" + UNKNOWN_LOCATION_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 LocationFhirResourceProviderIntegrationTest method shouldReturnNotFoundWhenUpdatingNonExistentLocationAsJson.
@Test
public void shouldReturnNotFoundWhenUpdatingNonExistentLocationAsJson() throws Exception {
// get the existing record
MockHttpServletResponse response = get("/Location/" + LOCATION_UUID).accept(FhirMediaTypes.JSON).go();
Location location = readResponse(response);
// update the existing record
location.setId(UNKNOWN_LOCATION_UUID);
// send the update to the server
response = put("/Location/" + UNKNOWN_LOCATION_UUID).jsonContent(toJson(location)).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 LocationFhirResourceProviderIntegrationTest method shouldReturnBadRequestWhenDocumentIdDoesNotMatchLocationIdAsXML.
@Test
public void shouldReturnBadRequestWhenDocumentIdDoesNotMatchLocationIdAsXML() throws Exception {
// get the existing record
MockHttpServletResponse response = get("/Location/" + LOCATION_UUID).accept(FhirMediaTypes.XML).go();
Location location = readResponse(response);
// update the existing record
location.setId(UNKNOWN_LOCATION_UUID);
// send the update to the server
response = put("/Location/" + LOCATION_UUID).xmlContent(toXML(location)).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));
}
Aggregations