use of org.sonar.db.rule.RuleTesting in project sonarqube by SonarSource.
the class CachingRuleFinderTest method constructor_reads_parameters_from_DB.
@Test
public void constructor_reads_parameters_from_DB() {
DbClient dbClient = mock(DbClient.class);
DbSession dbSession = mock(DbSession.class);
RuleDao ruleDao = mock(RuleDao.class);
when(dbClient.openSession(anyBoolean())).thenReturn(dbSession);
when(dbClient.ruleDao()).thenReturn(ruleDao);
List<RuleKey> ruleKeys = Arrays.asList(RuleKey.of("A", "B"), RuleKey.of("C", "D"), RuleKey.of("E", "F"));
when(ruleDao.selectAllDefinitions(dbSession)).thenReturn(ruleKeys.stream().map(RuleTesting::newRule).collect(toList()));
new CachingRuleFinder(dbClient);
verify(ruleDao).selectAllRuleParams(dbSession);
}