Search in sources :

Example 16 with FhirTask

use of org.openmrs.module.fhir2.model.FhirTask 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 17 with FhirTask

use of org.openmrs.module.fhir2.model.FhirTask 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 18 with FhirTask

use of org.openmrs.module.fhir2.model.FhirTask 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 19 with FhirTask

use of org.openmrs.module.fhir2.model.FhirTask 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)

Example 20 with FhirTask

use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.

the class FhirTaskTranslatorImplTest method toOpenmrsType_shouldUpdateEncounter.

@Test
public void toOpenmrsType_shouldUpdateEncounter() {
    Task task = new Task();
    shouldUpdateReferenceInOpenmrs(task, FhirConstants.ENCOUNTER, ENCOUNTER_UUID, task::setEncounter, FhirTask::getEncounterReference);
}
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

FhirTask (org.openmrs.module.fhir2.model.FhirTask)66 Test (org.junit.Test)57 Task (org.hl7.fhir.r4.model.Task)47 FhirReference (org.openmrs.module.fhir2.model.FhirReference)16 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)10 Reference (org.hl7.fhir.r4.model.Reference)9 Concept (org.openmrs.Concept)9 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)7 Date (java.util.Date)5 FhirTaskInput (org.openmrs.module.fhir2.model.FhirTaskInput)4 FhirTaskOutput (org.openmrs.module.fhir2.model.FhirTaskOutput)4 Coding (org.hl7.fhir.r4.model.Coding)3 StringType (org.hl7.fhir.r4.model.StringType)3 ArrayList (java.util.ArrayList)2 Identifier (org.hl7.fhir.r4.model.Identifier)2 Provenance (org.hl7.fhir.r4.model.Provenance)2 Before (org.junit.Before)2 HibernateConceptDAO (org.openmrs.api.db.hibernate.HibernateConceptDAO)2 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)1 Collection (java.util.Collection)1