Search in sources :

Example 26 with OperationOutcome

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

the class GroupFhirResourceProviderTest method shouldDeleteRequestedGroup.

@Test
public void shouldDeleteRequestedGroup() {
    when(fhirGroupService.delete(COHORT_UUID)).thenReturn(group);
    OperationOutcome result = resourceProvider.deleteGroup(new IdType().setValue(COHORT_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 27 with OperationOutcome

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

the class EncounterFhirResourceProviderTest method deleteEncounter_shouldDeleteRequestedEncounter.

@Test
public void deleteEncounter_shouldDeleteRequestedEncounter() {
    when(encounterService.delete(ENCOUNTER_UUID)).thenReturn(encounter);
    OperationOutcome result = resourceProvider.deleteEncounter(new IdType().setValue(ENCOUNTER_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 28 with OperationOutcome

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

the class GroupFhirResourceProviderTest method shouldDeleteRequestedGroup.

@Test
public void shouldDeleteRequestedGroup() {
    when(fhirGroupService.delete(COHORT_UUID)).thenReturn(group);
    OperationOutcome result = resourceProvider.deleteGroup(new IdType().setValue(COHORT_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 29 with OperationOutcome

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

the class ProcedureRequestFhirResourceProviderTest method deleteProcedureRequest_shouldDeleteProcedureRequest.

@Test
public void deleteProcedureRequest_shouldDeleteProcedureRequest() {
    when(serviceRequestService.delete(SERVICE_REQUEST_UUID)).thenReturn(serviceRequest);
    OperationOutcome result = resourceProvider.deleteProcedureRequest(new IdType().setValue(SERVICE_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"));
    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)

Example 30 with OperationOutcome

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

the class TaskFhirResourceProviderTest method deleteTask_shouldDeleteRequestedTask.

@Test
public void deleteTask_shouldDeleteRequestedTask() {
    when(taskService.delete(TASK_UUID)).thenReturn(task);
    OperationOutcome result = resourceProvider.deleteTask(new IdType().setValue(TASK_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)

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