@Test
public void filter_with_greater_than() {
addDocs(
- newDoc("P1", "K1", "N1").setMeasures(newArrayList(newMeasure(COVERAGE, 80d), newMeasure(NCLOC, 10_000d))),
- newDoc("P2", "K2", "N2").setMeasures(newArrayList(newMeasure(COVERAGE, 80d), newMeasure(NCLOC, 10_001d))),
- newDoc("P3", "K3", "N3").setMeasures(newArrayList(newMeasure(COVERAGE, 80d), newMeasure(NCLOC, 10_001d))));
-
- ProjectMeasuresQuery esQuery = new ProjectMeasuresQuery()
- .addMetricCriterion(new MetricCriteria(NCLOC, Operator.GT, 10_000d));
- List<String> result = underTest.search(esQuery, new SearchOptions()).getIds();
-
- assertThat(result).containsExactly("P2", "P3");
+ newDoc("P1", "K1", "N1").setMeasures(newArrayList(newMeasure(COVERAGE, 80d), newMeasure(NCLOC, 30_000d))),
+ newDoc("P2", "K2", "N2").setMeasures(newArrayList(newMeasure(COVERAGE, 80d), newMeasure(NCLOC, 30_001d))),
+ newDoc("P3", "K3", "N3").setMeasures(newArrayList(newMeasure(COVERAGE, 80d), newMeasure(NCLOC, 30_001d))));
+
+ assertThat(underTest.search(new ProjectMeasuresQuery().addMetricCriterion(new MetricCriteria(NCLOC, Operator.GT, 30_000d)),
+ new SearchOptions()).getIds()).containsExactly("P2", "P3");
+ assertThat(underTest.search(new ProjectMeasuresQuery().addMetricCriterion(new MetricCriteria(NCLOC, Operator.GT, 100_000d)),
+ new SearchOptions()).getIds()).isEmpty();
}
@Test