use of org.hisp.dhis.rules.models.RuleVariableCalculatedValue in project dhis2-core by dhis2.
the class ProgramRuleEntityMapperServiceTest method testMappedRuleVariableValues.
@Test
void testMappedRuleVariableValues() {
when(programRuleVariableService.getAllProgramRuleVariable()).thenReturn(programRuleVariables);
RuleVariableAttribute ruleVariableAttribute;
RuleVariableCalculatedValue ruleVariableCalculatedValue;
List<RuleVariable> ruleVariables = subject.toMappedProgramRuleVariables();
assertEquals(ruleVariables.size(), 3);
for (RuleVariable variable : ruleVariables) {
if (variable instanceof RuleVariableAttribute) {
ruleVariableAttribute = (RuleVariableAttribute) variable;
assertEquals(ruleVariableAttribute.trackedEntityAttribute(), programRuleVariableB.getAttribute().getUid());
assertEquals(ruleVariableAttribute.name(), programRuleVariableB.getName());
}
if (variable instanceof RuleVariableCalculatedValue) {
ruleVariableCalculatedValue = (RuleVariableCalculatedValue) variable;
assertEquals(ruleVariableCalculatedValue.name(), programRuleVariableA.getName());
}
}
}
Aggregations