use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method toFhirResource_shouldTranslateOutputReference.
// Task.output
@Test
public void toFhirResource_shouldTranslateOutputReference() {
FhirTask task = new FhirTask();
FhirTaskOutput output = new FhirTaskOutput();
FhirReference outputReference = new FhirReference();
Concept outputType = new Concept();
outputReference.setType(FhirConstants.DIAGNOSTIC_REPORT);
outputReference.setReference(DIAGNOSTIC_REPORT_UUID);
outputType.setUuid(CONCEPT_UUID);
output.setType(outputType);
output.setValueReference(outputReference);
task.setOutput(Collections.singleton(output));
when(conceptTranslator.toFhirResource(outputType)).thenReturn(new CodeableConcept().setCoding(Collections.singletonList(new Coding().setCode(CONCEPT_UUID))));
Task result = shouldTranslateReferenceToFhir(task, FhirConstants.DIAGNOSTIC_REPORT, DIAGNOSTIC_REPORT_UUID, output::setValueReference, t -> (Reference) t.getOutput().iterator().next().getValue());
assertThat(result.getOutput(), hasSize(1));
assertThat(result.getOutput().iterator().next().getType().getCoding().iterator().next().getCode(), equalTo(CONCEPT_UUID));
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method toFhirResource_shouldTranslateLastModified.
// Task.lastModified
@Test
public void toFhirResource_shouldTranslateLastModified() {
FhirTask task = new FhirTask();
Date dateModified = new Date();
task.setDateChanged(dateModified);
Task result = taskTranslator.toFhirResource(task);
assertThat(result, notNullValue());
assertThat(result.getLastModified(), equalTo(dateModified));
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method toFhirResource_shouldTranslateStatus.
// Task.status
@Test
public void toFhirResource_shouldTranslateStatus() {
FhirTask task = new FhirTask();
task.setStatus(OPENMRS_TASK_STATUS);
Task result = taskTranslator.toFhirResource(task);
assertThat(result, notNullValue());
assertThat(result.getStatus(), equalTo(FHIR_TASK_STATUS));
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method toFhirResource_shouldTranslateEncounter.
// Task.encounter
@Test
public void toFhirResource_shouldTranslateEncounter() {
FhirTask task = new FhirTask();
shouldTranslateReferenceToFhir(task, FhirConstants.ENCOUNTER, ENCOUNTER_UUID, task::setEncounterReference, Task::getEncounter);
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method toOpenmrsType_shouldTranslateOwner.
@Test
public void toOpenmrsType_shouldTranslateOwner() {
Task task = new Task();
shouldTranslateReferenceToOpenmrs(task, FhirConstants.ORGANIZATION, OPENELIS_ID, task::setOwner, FhirTask::getOwnerReference);
}
Aggregations