Search in sources :

Example 31 with OperationOutcome

use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.

the class MedicationRequestFhirResourceProviderTest method deleteTask_shouldDeleteMedicationRequest.

@Test
public void deleteTask_shouldDeleteMedicationRequest() {
    when(fhirMedicationRequestService.delete(MEDICATION_REQUEST_UUID)).thenReturn(medicationRequest);
    OperationOutcome result = resourceProvider.deleteMedicationRequest(new IdType().setValue(MEDICATION_REQUEST_UUID));
    assertThat(result, notNullValue());
    assertThat(result.getIssue(), notNullValue());
    assertThat(result.getIssueFirstRep().getSeverity(), equalTo(OperationOutcome.IssueSeverity.INFORMATION));
    assertThat(result.getIssueFirstRep().getDetails().getCodingFirstRep().getCode(), equalTo("MSG_DELETED"));
}
Also used : OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) IdType(org.hl7.fhir.r4.model.IdType) Test(org.junit.Test)

Example 32 with OperationOutcome

use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.

the class ObservationFhirResourceProviderTest method deleteObservation_shouldDeleteObservation.

@Test
public void deleteObservation_shouldDeleteObservation() {
    when(observationService.delete(OBSERVATION_UUID)).thenReturn(observation);
    OperationOutcome result = resourceProvider.deleteObservationResource(new IdType().setValue(OBSERVATION_UUID));
    assertThat(result, notNullValue());
    assertThat(result.getIssue(), notNullValue());
    assertThat(result.getIssueFirstRep().getSeverity(), equalTo(OperationOutcome.IssueSeverity.INFORMATION));
    assertThat(result.getIssueFirstRep().getDetails().getCodingFirstRep().getCode(), equalTo("MSG_DELETED"));
}
Also used : OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) IdType(org.hl7.fhir.r4.model.IdType) BaseFhirProvenanceResourceTest(org.openmrs.module.fhir2.providers.BaseFhirProvenanceResourceTest) Test(org.junit.Test)

Example 33 with OperationOutcome

use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.

the class PersonFhirResourceProviderTest method deletePerson_shouldDeletePerson.

@Test
public void deletePerson_shouldDeletePerson() {
    when(fhirPersonService.delete(PERSON_UUID)).thenReturn(person);
    OperationOutcome result = resourceProvider.deletePerson(new IdType().setValue(PERSON_UUID));
    assertThat(result, notNullValue());
    assertThat(result.getIssueFirstRep().getSeverity(), equalTo(OperationOutcome.IssueSeverity.INFORMATION));
    assertThat(result.getIssueFirstRep().getDetails().getCodingFirstRep().getCode(), equalTo("MSG_DELETED"));
    assertThat(result.getIssueFirstRep().getDetails().getCodingFirstRep().getDisplay(), equalTo("This resource has been deleted"));
}
Also used : OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) IdType(org.hl7.fhir.r4.model.IdType) BaseFhirProvenanceResourceTest(org.openmrs.module.fhir2.providers.BaseFhirProvenanceResourceTest) Test(org.junit.Test)

Example 34 with OperationOutcome

use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.

the class MedicationRequestFhirResourceProviderTest method deleteMedicationRequest_shouldDeleteMedicationRequest.

@Test
public void deleteMedicationRequest_shouldDeleteMedicationRequest() {
    when(fhirMedicationRequestService.delete(MEDICATION_REQUEST_UUID)).thenReturn(medicationRequest);
    OperationOutcome result = resourceProvider.deleteMedicationRequest(new IdType().setValue(MEDICATION_REQUEST_UUID));
    assertThat(result, notNullValue());
    assertThat(result.getIssue(), notNullValue());
    assertThat(result.getIssueFirstRep().getSeverity(), equalTo(OperationOutcome.IssueSeverity.INFORMATION));
    assertThat(result.getIssueFirstRep().getDetails().getCodingFirstRep().getCode(), equalTo("MSG_DELETED"));
}
Also used : OperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.Test)

Example 35 with OperationOutcome

use of org.hl7.fhir.r5.model.OperationOutcome in project openmrs-module-fhir2 by openmrs.

the class PatientFhirResourceProviderTest method deletePatient_shouldDeleteRequestedPatient.

@Test
public void deletePatient_shouldDeleteRequestedPatient() {
    when(patientService.delete(PATIENT_UUID)).thenReturn(patient);
    OperationOutcome result = patientFhirResourceProvider.deletePatient(new IdType().setValue(PATIENT_UUID));
    assertThat(result, notNullValue());
    assertThat(result.getIssue(), notNullValue());
    assertThat(result.getIssueFirstRep().getSeverity(), equalTo(OperationOutcome.IssueSeverity.INFORMATION));
    assertThat(result.getIssueFirstRep().getDetails().getCodingFirstRep().getCode(), equalTo("MSG_DELETED"));
    assertThat(result.getIssueFirstRep().getDetails().getCodingFirstRep().getDisplay(), equalTo("This resource has been deleted"));
}
Also used : OperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)214 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)181 OperationOutcome (org.hl7.fhir.r4.model.OperationOutcome)161 OperationOutcome (org.hl7.fhir.dstu3.model.OperationOutcome)144 Test (org.junit.jupiter.api.Test)42 BaseFhirIntegrationTest (org.openmrs.module.fhir2.BaseFhirIntegrationTest)31 IOException (java.io.IOException)26 IBaseOperationOutcome (org.hl7.fhir.instance.model.api.IBaseOperationOutcome)24 OperationOutcomeIssueComponent (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent)23 MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)22 OperationOutcome (org.hl7.fhir.r5.model.OperationOutcome)20 IdType (org.hl7.fhir.dstu3.model.IdType)17 IdType (org.hl7.fhir.r4.model.IdType)17 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)15 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)15 URISyntaxException (java.net.URISyntaxException)13 GET (javax.ws.rs.GET)12 Path (javax.ws.rs.Path)12 Produces (javax.ws.rs.Produces)12 Header (org.apache.http.Header)11