use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.
the class PersonFhirResourceProviderWebTest method deletePerson_shouldDeletePerson.
@Test
public void deletePerson_shouldDeletePerson() throws Exception {
OperationOutcome retVal = new OperationOutcome();
retVal.setId(PERSON_UUID);
retVal.getText().setDivAsString("Deleted successfully");
org.hl7.fhir.r4.model.Person person = new org.hl7.fhir.r4.model.Person();
person.setId(PERSON_UUID);
when(personService.delete(PERSON_UUID)).thenReturn(person);
MockHttpServletResponse response = delete("/Person/" + PERSON_UUID).accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), equalTo(FhirMediaTypes.JSON.toString()));
}
use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.
the class PractitionerFhirResourceProviderWebTest method deletePractitioner_shouldDeletePractitioner.
@Test
public void deletePractitioner_shouldDeletePractitioner() throws Exception {
OperationOutcome retVal = new OperationOutcome();
retVal.setId(PRACTITIONER_UUID);
retVal.getText().setDivAsString("Deleted successfully");
org.hl7.fhir.r4.model.Practitioner practitioner = new org.hl7.fhir.r4.model.Practitioner();
practitioner.setId(PRACTITIONER_UUID);
when(practitionerService.delete(PRACTITIONER_UUID)).thenReturn(practitioner);
MockHttpServletResponse response = delete("/Practitioner/" + PRACTITIONER_UUID).accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), equalTo(FhirMediaTypes.JSON.toString()));
}
use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.
the class GroupFhirResourceProviderWebTest method deleteGroup_shouldDeleteGroup.
@Test
public void deleteGroup_shouldDeleteGroup() throws Exception {
OperationOutcome retVal = new OperationOutcome();
retVal.setId(COHORT_UUID);
retVal.getText().setDivAsString("Deleted Successfully");
org.hl7.fhir.r4.model.Group group = new org.hl7.fhir.r4.model.Group();
group.setId(COHORT_UUID);
when(groupService.delete(COHORT_UUID)).thenReturn(group);
MockHttpServletResponse response = delete("/Group/" + COHORT_UUID).accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), equalTo(FhirMediaTypes.JSON.toString()));
}
use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.
the class BaseFhirR3ResourceProviderWebTest method describeOperationOutcome.
@Override
public void describeOperationOutcome(Description mismatchDescription, IBaseOperationOutcome baseOperationOutcome) {
if (baseOperationOutcome instanceof OperationOutcome) {
OperationOutcome operationOutcome = (OperationOutcome) baseOperationOutcome;
if (operationOutcome.hasIssue() && operationOutcome.getIssue().stream().anyMatch(o -> o.getSeverity().ordinal() <= OperationOutcome.IssueSeverity.WARNING.ordinal())) {
mismatchDescription.appendText(" with message ");
mismatchDescription.appendValue(operationOutcome.getIssue().stream().filter(o -> o.getSeverity().ordinal() <= OperationOutcome.IssueSeverity.WARNING.ordinal()).map(OperationOutcome.OperationOutcomeIssueComponent::getDiagnostics).collect(Collectors.joining(". ")));
}
}
}
use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.
the class PatientFhirResourceProviderWebTest method deletePatient_shouldDeletePatient.
@Test
public void deletePatient_shouldDeletePatient() throws Exception {
OperationOutcome retVal = new OperationOutcome();
retVal.setId(PATIENT_UUID);
retVal.getText().setDivAsString("Deleted successfully");
Patient patient = new Patient();
patient.setId(PATIENT_UUID);
when(patientService.delete(PATIENT_UUID)).thenReturn(patient);
MockHttpServletResponse response = delete("/Patient/" + PATIENT_UUID).accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), equalTo(FhirMediaTypes.JSON.toString()));
}
Aggregations