use of org.sonar.api.batch.rule.ActiveRules in project sonarqube by SonarSource.
the class SensorOptimizerTest method should_optimize_on_repository.
@Test
public void should_optimize_on_repository() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor().createIssuesForRuleRepositories("squid");
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
ActiveRules activeRules = new ActiveRulesBuilder().create(RuleKey.of("repo1", "foo")).activate().build();
optimizer = new SensorOptimizer(fs, activeRules, settings);
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
activeRules = new ActiveRulesBuilder().create(RuleKey.of("repo1", "foo")).activate().create(RuleKey.of("squid", "rule")).activate().build();
optimizer = new SensorOptimizer(fs, activeRules, settings);
assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
Aggregations