Search in sources :

Example 16 with Task

use of org.hl7.fhir.r4.model.Task in project openmrs-module-fhir2 by openmrs.

the class FhirTaskTranslatorImplTest method toOpenmrsType_shouldUpdateFor.

@Test
public void toOpenmrsType_shouldUpdateFor() {
    Task task = new Task();
    shouldUpdateReferenceInOpenmrs(task, FhirConstants.PATIENT, PATIENT_UUID, task::setFor, FhirTask::getForReference);
}
Also used : Task(org.hl7.fhir.r4.model.Task) FhirTask(org.openmrs.module.fhir2.model.FhirTask) FhirTask(org.openmrs.module.fhir2.model.FhirTask) Test(org.junit.Test)

Example 17 with Task

use of org.hl7.fhir.r4.model.Task in project openmrs-module-fhir2 by openmrs.

the class FhirTaskTranslatorImplTest method toFhirResource_shouldSetBusinessIdentifier.

// Task.Identifier
@Test
public void toFhirResource_shouldSetBusinessIdentifier() {
    // https://www.hl7.org/fhir/resource.html#identifiers
    FhirTask task = new FhirTask();
    Task result = taskTranslator.toFhirResource(task);
    assertThat(result, notNullValue());
    assertThat(result.getIdentifier(), hasSize(1));
    Identifier identifier = result.getIdentifier().iterator().next();
    assertThat(identifier.getValue(), equalTo(task.getUuid()));
    assertThat(identifier.getSystem(), equalTo(FhirConstants.OPENMRS_FHIR_EXT_TASK_IDENTIFIER));
}
Also used : Task(org.hl7.fhir.r4.model.Task) FhirTask(org.openmrs.module.fhir2.model.FhirTask) Identifier(org.hl7.fhir.r4.model.Identifier) FhirTask(org.openmrs.module.fhir2.model.FhirTask) Test(org.junit.Test)

Example 18 with Task

use of org.hl7.fhir.r4.model.Task in project openmrs-module-fhir2 by openmrs.

the class FhirTaskTranslatorImplTest method toOpenmrsType_shouldTranslateStatus.

@Test
public void toOpenmrsType_shouldTranslateStatus() {
    Task task = new Task();
    task.setStatus(FHIR_TASK_STATUS);
    FhirTask result = taskTranslator.toOpenmrsType(task);
    assertThat(result, notNullValue());
    assertThat(result.getStatus(), equalTo(OPENMRS_TASK_STATUS));
}
Also used : Task(org.hl7.fhir.r4.model.Task) FhirTask(org.openmrs.module.fhir2.model.FhirTask) FhirTask(org.openmrs.module.fhir2.model.FhirTask) Test(org.junit.Test)

Example 19 with Task

use of org.hl7.fhir.r4.model.Task in project openmrs-module-fhir2 by openmrs.

the class FhirTaskTranslatorImplTest method toOpenmrsType_shouldTranslateFor.

@Test
public void toOpenmrsType_shouldTranslateFor() {
    Task task = new Task();
    shouldTranslateReferenceToOpenmrs(task, FhirConstants.PATIENT, PATIENT_UUID, task::setFor, FhirTask::getForReference);
}
Also used : Task(org.hl7.fhir.r4.model.Task) FhirTask(org.openmrs.module.fhir2.model.FhirTask) FhirTask(org.openmrs.module.fhir2.model.FhirTask) Test(org.junit.Test)

Example 20 with Task

use of org.hl7.fhir.r4.model.Task in project openmrs-module-fhir2 by openmrs.

the class FhirTaskTranslatorImplTest method toOpenmrsType_shouldUpdateBasedOn.

@Test
public void toOpenmrsType_shouldUpdateBasedOn() {
    Task task = new Task();
    shouldUpdateReferenceListInOpenmrs(task, FhirConstants.SERVICE_REQUEST, SERVICE_REQUEST_UUID, task::setBasedOn, FhirTask::getBasedOnReferences);
}
Also used : Task(org.hl7.fhir.r4.model.Task) FhirTask(org.openmrs.module.fhir2.model.FhirTask) FhirTask(org.openmrs.module.fhir2.model.FhirTask) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)127 Task (org.hl7.fhir.r4.model.Task)120 FhirTask (org.openmrs.module.fhir2.model.FhirTask)59 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)46 Bundle (org.hl7.fhir.r4.model.Bundle)40 Reference (org.hl7.fhir.r4.model.Reference)28 ServiceRequest (org.hl7.fhir.r4.model.ServiceRequest)24 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)23 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)22 Task (org.hl7.fhir.dstu3.model.Task)21 IdType (org.hl7.fhir.r4.model.IdType)21 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)17 Date (java.util.Date)16 ArrayList (java.util.ArrayList)13 List (java.util.List)13 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)13 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)12 TokenAndListParam (ca.uhn.fhir.rest.param.TokenAndListParam)11 TokenParam (ca.uhn.fhir.rest.param.TokenParam)11 Collectors (java.util.stream.Collectors)11