use of org.sonar.server.measure.index.ProjectMeasuresQuery in project sonarqube by SonarSource.
the class ProjectMeasuresQueryFactoryTest method create_query_having_q.
@Test
public void create_query_having_q() throws Exception {
List<Criterion> criteria = singletonList(Criterion.builder().setKey("query").setOperator(EQ).setValue("Sonar Qube").build());
ProjectMeasuresQuery underTest = newProjectMeasuresQuery(criteria, emptySet());
assertThat(underTest.getQueryText().get()).isEqualTo("Sonar Qube");
}
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