use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskDaoImplTest method saveTask_shouldUpdateTaskStatus.
@Test
public void saveTask_shouldUpdateTaskStatus() {
FhirTask toUpdate = dao.get(TASK_UUID);
toUpdate.setStatus(NEW_STATUS);
dao.createOrUpdate(toUpdate);
assertThat(dao.get(TASK_UUID).getStatus(), equalTo(NEW_STATUS));
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskDaoImplTest method saveTask_shouldUpdateBasedOnReferences.
@Test
public void saveTask_shouldUpdateBasedOnReferences() {
FhirTask toUpdate = dao.get(TASK_UUID);
FhirReference basedOnReference = new FhirReference();
basedOnReference.setType(FhirConstants.SERVICE_REQUEST);
basedOnReference.setReference(BASED_ON_ORDER_UUID);
basedOnReference.setName("TEMP");
toUpdate.setBasedOnReferences(Collections.singleton(basedOnReference));
dao.createOrUpdate(toUpdate);
FhirTask result = dao.get(TASK_UUID);
assertThat(result.getBasedOnReferences(), notNullValue());
assertThat(result.getBasedOnReferences().size(), greaterThan(0));
assertThat(result.getBasedOnReferences(), hasItem(hasProperty("type", equalTo(FhirConstants.SERVICE_REQUEST))));
assertThat(result.getBasedOnReferences(), hasItem(hasProperty("reference", equalTo(BASED_ON_ORDER_UUID))));
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskDaoImplTest method saveTask_shouldUpdateOwnerReference.
@Test
public void saveTask_shouldUpdateOwnerReference() {
FhirTask toUpdate = dao.get(TASK_UUID);
FhirReference ownerReference = new FhirReference();
ownerReference.setType(FhirConstants.PRACTITIONER);
ownerReference.setReference(USER_UUID);
ownerReference.setName("TEMP");
toUpdate.setOwnerReference(ownerReference);
dao.createOrUpdate(toUpdate);
FhirTask result = dao.get(TASK_UUID);
assertThat(result.getOwnerReference(), notNullValue());
assertThat(result.getOwnerReference().getId(), notNullValue());
assertThat(result.getOwnerReference().getType(), equalTo(FhirConstants.PRACTITIONER));
assertThat(result.getOwnerReference().getReference(), equalTo(USER_UUID));
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskDaoImplTest method saveTask_shouldUpdateForReference.
@Test
public void saveTask_shouldUpdateForReference() {
FhirTask toUpdate = dao.get(TASK_UUID);
FhirReference forReference = new FhirReference();
forReference.setType(FhirConstants.PATIENT);
forReference.setReference(PATIENT_ID);
forReference.setName("TEMP");
toUpdate.setForReference(forReference);
dao.createOrUpdate(toUpdate);
FhirTask result = dao.get(TASK_UUID);
assertThat(result.getForReference(), notNullValue());
assertThat(result.getForReference().getId(), notNullValue());
assertThat(result.getForReference().getType(), equalTo(FhirConstants.PATIENT));
assertThat(result.getForReference().getReference(), equalTo(PATIENT_ID));
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class ProvenanceTranslatorImplTest method shouldGetCreateProvenanceForOpenmrsMetaWithoutChange.
@Test
public void shouldGetCreateProvenanceForOpenmrsMetaWithoutChange() {
FhirTask task = new FhirTask();
task.setUuid(TASK_UUID);
task.setCreator(user);
task.setDateCreated(new Date());
Provenance provenance = taskProvenanceTranslator.getCreateProvenance(task);
assertThat(provenance, notNullValue());
assertThat(provenance.getId(), notNullValue());
}
Aggregations