use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskDaoImplTest method searchForTasks_shouldHandleNullBasedOnRefs.
@Test
public void searchForTasks_shouldHandleNullBasedOnRefs() {
FhirTask toUpdate = dao.get(TASK_UUID);
FhirReference nullTypeRef = new FhirReference();
nullTypeRef.setType(null);
nullTypeRef.setReference(BASED_ON_ORDER_UUID);
toUpdate.setOwnerReference(nullTypeRef);
toUpdate.setBasedOnReferences(Collections.singleton(nullTypeRef));
dao.createOrUpdate(toUpdate);
FhirTask result = dao.get(TASK_UUID);
assertThat(result.getBasedOnReferences(), notNullValue());
assertThat(result.getBasedOnReferences().size(), greaterThan(0));
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskDaoImplTest method saveTask_shouldUpdateEncounterReference.
@Test
public void saveTask_shouldUpdateEncounterReference() {
FhirTask toUpdate = dao.get(TASK_UUID);
FhirReference forReference = new FhirReference();
forReference.setType(FhirConstants.ENCOUNTER);
forReference.setReference(ENCOUNTER_UUID);
forReference.setName("TEMP");
toUpdate.setEncounterReference(forReference);
dao.createOrUpdate(toUpdate);
FhirTask result = dao.get(TASK_UUID);
assertThat(result.getEncounterReference(), notNullValue());
assertThat(result.getEncounterReference().getId(), notNullValue());
assertThat(result.getEncounterReference().getType(), equalTo(FhirConstants.ENCOUNTER));
assertThat(result.getEncounterReference().getReference(), equalTo(ENCOUNTER_UUID));
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskDaoImplTest method getTaskByUuid_shouldRetrieveTaskByUuid.
@Test
public void getTaskByUuid_shouldRetrieveTaskByUuid() {
FhirTask result = dao.get(TASK_UUID);
assertThat(result, notNullValue());
assertThat(result.getUuid(), equalTo(TASK_UUID));
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method toOpenmrsType_shouldUpdateIntentOnExistingTask.
@Test
public void toOpenmrsType_shouldUpdateIntentOnExistingTask() {
FhirTask task = new FhirTask();
task.setIntent(null);
task.setUuid(TASK_UUID);
Task fhirTask = taskTranslator.toFhirResource(task);
fhirTask.setIntent(FHIR_TASK_INTENT);
FhirTask result = taskTranslator.toOpenmrsType(task, fhirTask);
assertThat(result, notNullValue());
assertThat(result.getIntent(), equalTo(OPENMRS_TASK_INTENT));
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method toOpenmrsType_shouldSetOpenmrsTaskUUIDWhenNull.
@Test
public void toOpenmrsType_shouldSetOpenmrsTaskUUIDWhenNull() {
FhirTask task = new FhirTask();
task.setUuid(null);
Task fhirTask = taskTranslator.toFhirResource(task);
fhirTask.setId(TASK_UUID);
FhirTask result = taskTranslator.toOpenmrsType(task, fhirTask);
assertThat(result, notNullValue());
assertThat(result.getUuid(), equalTo(TASK_UUID));
}
Aggregations