use of org.hisp.dhis.rules.models.RuleValidationResult in project dhis2-core by dhis2.
the class ProgramRuleEngineDescriptionTest method testProgramRuleWithTextTrackedEntityAttribute.
@Test
void testProgramRuleWithTextTrackedEntityAttribute() {
RuleValidationResult result = validateRuleCondition(programRuleTextAtt.getCondition(), program);
assertNotNull(result);
assertEquals("AttributeA == 'text_att' || Current date", result.getDescription());
assertTrue(result.isValid());
}
use of org.hisp.dhis.rules.models.RuleValidationResult in project dhis2-core by dhis2.
the class ProgramRuleEngineDescriptionTest method testProgramRuleWithNumericTrackedEntityAttributeWithOr.
@Test
void testProgramRuleWithNumericTrackedEntityAttributeWithOr() {
RuleValidationResult result = validateRuleCondition(conditionNumericAttWithOR, program);
assertNotNull(result);
assertEquals("AttributeB == 12 or Current date", result.getDescription());
assertTrue(result.isValid());
}
use of org.hisp.dhis.rules.models.RuleValidationResult in project dhis2-core by dhis2.
the class ProgramRuleEngineDescriptionTest method testIncorrectRuleWithDataElement.
@Test
void testIncorrectRuleWithDataElement() {
RuleValidationResult result = validateRuleCondition(incorrectConditionTextDE, program);
assertNotNull(result);
assertFalse(result.isValid());
assertThat(result.getException(), instanceOf(IllegalStateException.class));
}
use of org.hisp.dhis.rules.models.RuleValidationResult in project dhis2-core by dhis2.
the class ProgramRuleEngineDescriptionTest method testProgramRuleWithD2HasValueTrackedEntityAttribute.
@Test
void testProgramRuleWithD2HasValueTrackedEntityAttribute() {
RuleValidationResult result = validateRuleCondition(programRuleWithD2HasValue.getCondition(), program);
assertNotNull(result);
assertEquals("AttributeA", result.getDescription());
assertTrue(result.isValid());
}
use of org.hisp.dhis.rules.models.RuleValidationResult in project dhis2-core by dhis2.
the class ProgramRuleEngineDescriptionTest method testProgramRuleWithNumericTrackedEntityAttributeWithAnd.
@Test
void testProgramRuleWithNumericTrackedEntityAttributeWithAnd() {
RuleValidationResult result = validateRuleCondition(conditionNumericAttWithAND, program);
assertNotNull(result);
assertEquals("AttributeB == 12 and Current date", result.getDescription());
assertTrue(result.isValid());
}
Aggregations