use of org.openmrs.module.pihcore.reporting.cohort.definition.PersonAuditInfoCohortDefinition in project openmrs-module-pihcore by PIH.
the class PersonAuditInfoCohortDefinitionEvaluatorTest method testEvaluateWithNoParameters.
@Test
public void testEvaluateWithNoParameters() throws Exception {
PersonAuditInfoCohortDefinition cd = new PersonAuditInfoCohortDefinition();
EvaluatedCohort actual = evaluator.evaluate((CohortDefinition) cd, new EvaluationContext());
assertThat(actual, hasExactlyIds(2, 6, 7, 8));
}
use of org.openmrs.module.pihcore.reporting.cohort.definition.PersonAuditInfoCohortDefinition in project openmrs-module-pihcore by PIH.
the class PersonAuditInfoCohortDefinitionEvaluatorTest method testEvaluateIncludingVoided.
@Test
public void testEvaluateIncludingVoided() throws Exception {
PersonAuditInfoCohortDefinition cd = new PersonAuditInfoCohortDefinition();
cd.setIncludeVoided(true);
EvaluatedCohort actual = evaluator.evaluate((CohortDefinition) cd, new EvaluationContext());
assertThat(actual, hasExactlyIds(2, 6, 7, 8, 432, 999));
}
use of org.openmrs.module.pihcore.reporting.cohort.definition.PersonAuditInfoCohortDefinition in project openmrs-module-pihcore by PIH.
the class PersonAuditInfoCohortDefinitionEvaluatorTest method testEvaluateByChangedDetails.
@Test
public void testEvaluateByChangedDetails() throws Exception {
PersonAuditInfoCohortDefinition cd = new PersonAuditInfoCohortDefinition();
cd.setChangedOnOrAfter(DateUtil.parseDate("2008-08-18 12:25", "yyyy-MM-dd HH:mm"));
cd.setChangedOnOrBefore(DateUtil.parseDate("2008-08-18 12:26", "yyyy-MM-dd HH:mm"));
EvaluatedCohort actual = evaluator.evaluate((CohortDefinition) cd, new EvaluationContext());
assertThat(actual, hasExactlyIds(6, 7));
}
use of org.openmrs.module.pihcore.reporting.cohort.definition.PersonAuditInfoCohortDefinition in project openmrs-module-pihcore by PIH.
the class PersonAuditInfoCohortDefinitionEvaluatorTest method testEvaluateByCreationDetails.
@Test
public void testEvaluateByCreationDetails() throws Exception {
PersonAuditInfoCohortDefinition cd = new PersonAuditInfoCohortDefinition();
cd.setCreatedOnOrAfter(DateUtil.parseDate("2005-09-22", "yyyy-MM-dd"));
cd.setCreatedOnOrBefore(DateUtil.parseDate("2005-09-22", "yyyy-MM-dd"));
cd.setCreatedByUsers(Arrays.asList(userService.getUser(1)));
EvaluatedCohort actual = evaluator.evaluate((CohortDefinition) cd, new EvaluationContext());
assertThat(actual, hasExactlyIds(2));
}
use of org.openmrs.module.pihcore.reporting.cohort.definition.PersonAuditInfoCohortDefinition in project openmrs-module-pihcore by PIH.
the class PersonAuditInfoCohortDefinitionEvaluatorTest method testEvaluateByVoidedDetails.
@Test
public void testEvaluateByVoidedDetails() throws Exception {
Date today = DateUtil.getStartOfDay(new Date());
// in standardTestDataset.xml patient 999 is voided, but has no dateVoided. Fix this
Patient voidedPatient = patientService.getPatient(999);
voidedPatient.addName(new PersonName("A", "Non-voided", "Name"));
patientService.voidPatient(voidedPatient, "testing");
PersonAuditInfoCohortDefinition cd = new PersonAuditInfoCohortDefinition();
cd.setIncludeVoided(true);
cd.setVoidedOnOrAfter(today);
cd.setVoidedOnOrBefore(today);
EvaluatedCohort actual = evaluator.evaluate((CohortDefinition) cd, new EvaluationContext());
assertThat(actual, hasExactlyIds(999));
}
Aggregations