use of org.sonar.server.measure.index.ProjectMeasuresQuery in project sonarqube by SonarSource.
the class ProjectMeasuresQueryFactoryTest method create_query_on_language_using_in_operator.
@Test
public void create_query_on_language_using_in_operator() {
ProjectMeasuresQuery query = newProjectMeasuresQuery(singletonList(Criterion.builder().setKey("languages").setOperator(IN).setValues(asList("java", "js")).build()), emptySet());
assertThat(query.getLanguages().get()).containsOnly("java", "js");
}
use of org.sonar.server.measure.index.ProjectMeasuresQuery in project sonarqube by SonarSource.
the class ProjectMeasuresQueryValidatorTest method return_all_unknown_metrics.
@Test
public void return_all_unknown_metrics() throws Exception {
insertValidMetric("ncloc");
ProjectMeasuresQuery query = new ProjectMeasuresQuery().addMetricCriterion(new MetricCriterion("debt", GT, 10d)).addMetricCriterion(new MetricCriterion("ncloc", LTE, 20d)).addMetricCriterion(new MetricCriterion("coverage", GT, 30d)).setSort("duplications");
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("Unknown metric(s) [coverage, debt, duplications]");
underTest.validate(dbSession, query);
}
use of org.sonar.server.measure.index.ProjectMeasuresQuery in project sonarqube by SonarSource.
the class ProjectMeasuresQueryValidatorTest method does_not_fail_when_sort_is_by_name.
@Test
public void does_not_fail_when_sort_is_by_name() throws Exception {
insertValidMetric("ncloc");
ProjectMeasuresQuery query = new ProjectMeasuresQuery().addMetricCriterion(new MetricCriterion("ncloc", GT, 10d)).setSort("name");
underTest.validate(dbSession, query);
}
use of org.sonar.server.measure.index.ProjectMeasuresQuery in project sonarqube by SonarSource.
the class ProjectMeasuresQueryValidatorTest method does_not_fail_when_metric_criteria_contains_an_existing_metric.
@Test
public void does_not_fail_when_metric_criteria_contains_an_existing_metric() throws Exception {
insertValidMetric("ncloc");
ProjectMeasuresQuery query = new ProjectMeasuresQuery().addMetricCriterion(new MetricCriterion("ncloc", GT, 10d));
underTest.validate(dbSession, query);
}
Aggregations