use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method toOpenmrsType_shouldTranslateBasedOn.
@Test
public void toOpenmrsType_shouldTranslateBasedOn() {
Task task = new Task();
shouldTranslateReferenceListToOpenmrs(task, FhirConstants.SERVICE_REQUEST, SERVICE_REQUEST_UUID, task::setBasedOn, FhirTask::getBasedOnReferences);
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method shouldUpdateReferenceInOpenmrs.
private FhirTask shouldUpdateReferenceInOpenmrs(Task task, String refType, String refUuid, Consumer<Reference> setFhirReference, Function<FhirTask, FhirReference> getOpenmrsReference) {
Reference fhirReference = new Reference().setReference(refUuid).setType(refType);
setFhirReference.accept(fhirReference);
FhirReference openmrsReference = new FhirReference();
openmrsReference.setReference(refUuid);
openmrsReference.setType(refType);
FhirTask openmrsTask = new FhirTask();
openmrsTask.setUuid(TASK_UUID);
openmrsTask.setEncounterReference(new FhirReference());
when(referenceTranslator.toOpenmrsType(any(Reference.class))).thenReturn(openmrsReference);
FhirTask result = taskTranslator.toOpenmrsType(openmrsTask, task);
FhirReference resultReference = getOpenmrsReference.apply(result);
assertThat(resultReference, notNullValue());
assertThat(resultReference.getReference(), equalTo(refUuid));
assertThat(resultReference.getType(), equalTo(refType));
return result;
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method toOpenmrsType_shouldTranslateFhirTaskToOpenmrsTask.
@Test
public void toOpenmrsType_shouldTranslateFhirTaskToOpenmrsTask() {
Task task = new Task();
FhirTask result = taskTranslator.toOpenmrsType(task);
assertThat(result, notNullValue());
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method toFhirResource_shouldTranslateOpenmrsTaskToFhirTask.
@Test
public void toFhirResource_shouldTranslateOpenmrsTaskToFhirTask() {
FhirTask task = new FhirTask();
Task result = taskTranslator.toFhirResource(task);
assertThat(result, notNullValue());
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method toFhirResource_shouldTranslateAuthoredOn.
// Task.authoredOn
@Test
public void toFhirResource_shouldTranslateAuthoredOn() {
FhirTask task = new FhirTask();
Date createdDate = new Date();
task.setDateCreated(createdDate);
Task result = taskTranslator.toFhirResource(task);
assertThat(result, notNullValue());
assertThat(result.getAuthoredOn(), equalTo(createdDate));
}
Aggregations