use of org.hisp.dhis.dataintegrity.DataIntegrityDetails.DataIntegrityIssue in project dhis2-core by dhis2.
the class DataIntegrityServiceTest method testGetProgramRulesVariableWithNoDataElement.
@Test
void testGetProgramRulesVariableWithNoDataElement() {
programRuleVariableA.setProgram(programA);
when(programRuleVariableService.getVariablesWithNoDataElement()).thenReturn(List.of(programRuleVariableA));
List<DataIntegrityIssue> issues = subject.getProgramRuleVariablesWithNoDataElement();
verify(programRuleVariableService).getVariablesWithNoDataElement();
verify(programRuleVariableService, times(1)).getVariablesWithNoDataElement();
assertEquals(1, issues.size());
DataIntegrityIssue issue = issues.get(0);
assertEquals(issueName(programA), issue.getName());
assertContainsOnly(issue.getRefs(), issueName(programRuleVariableA));
}
use of org.hisp.dhis.dataintegrity.DataIntegrityDetails.DataIntegrityIssue in project dhis2-core by dhis2.
the class DataIntegrityServiceTest method testGetProgramRulesWithNoExpression.
@Test
void testGetProgramRulesWithNoExpression() {
programRuleB.setCondition(null);
when(programRuleService.getProgramRulesWithNoCondition()).thenReturn(List.of(programRuleB));
List<DataIntegrityIssue> issues = subject.getProgramRulesWithNoCondition();
verify(programRuleService).getProgramRulesWithNoCondition();
verify(programRuleService, times(1)).getProgramRulesWithNoCondition();
assertEquals(1, issues.size());
DataIntegrityIssue issue = issues.get(0);
assertEquals(issueName(programB), issue.getName());
assertContainsOnly(issue.getRefs(), issueName(programRuleB));
}
use of org.hisp.dhis.dataintegrity.DataIntegrityDetails.DataIntegrityIssue in project dhis2-core by dhis2.
the class DataIntegrityServiceTest method testValidProgramIndicatorFilter.
@Test
void testValidProgramIndicatorFilter() {
ProgramIndicator programIndicator = new ProgramIndicator();
programIndicator.setName("Test-PI");
programIndicator.setFilter("1 < 2");
when(programIndicatorService.filterIsValid(anyString())).thenReturn(true);
when(programIndicatorService.getAllProgramIndicators()).thenReturn(List.of(programIndicator));
List<DataIntegrityIssue> issues = subject.getInvalidProgramIndicatorFilters();
verify(expressionService, times(0)).getExpressionDescription(anyString(), any());
assertTrue(issues.isEmpty());
}
Aggregations