/** TODO make this test use assert statements instead of printing to stdout */ @Test public void shouldDemographicsRule() { LogicService logicService = Context.getLogicService(); Cohort patients = new Cohort(); Map<Integer, Result> result; patients.addMember(2); try { result = logicService.eval(patients, new LogicCriteriaImpl("BIRTHDATE")); Assert.assertNotNull(result); result = logicService.eval(patients, new LogicCriteriaImpl("AGE")); Assert.assertNotNull(result); result = logicService.eval(patients, new LogicCriteriaImpl("AGE").gt(10)); Assert.assertNotNull(result); Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 2000); result = logicService.eval(patients, new LogicCriteriaImpl("BIRTHDATE").after(cal.getTime())); Assert.assertNotNull(result); result = logicService.eval(patients, new LogicCriteriaImpl("BIRTHDATE").before(cal.getTime())); Assert.assertNotNull(result); // test the index date functionality Calendar index = Calendar.getInstance(); index.set(1970, 0, 1); result = logicService.eval(patients, new LogicCriteriaImpl("BIRTHDATE")); Assert.assertNotNull(result); result = logicService.eval(patients, new LogicCriteriaImpl("BIRTHDATE").within(Duration.years(5))); Assert.assertNotNull(result); } catch (LogicException e) { log.error("testDemographicsRule: Error generated", e); } }