Search in sources :

Example 1 with MetricType

use of org.sonar.server.computation.task.projectanalysis.metric.Metric.MetricType in project sonarqube by SonarSource.

the class ConditionEvaluatorTest method test_condition_on_period.

@Test
public void test_condition_on_period() {
    for (MetricType metricType : ImmutableList.of(FLOAT, INT, WORK_DUR)) {
        Metric metric = createMetric(metricType);
        Measure measure = newMeasureBuilder().setVariation(3d).createNoValue();
        assertThat(underTest.evaluate(new Condition(metric, GREATER_THAN.getDbValue(), "3", null, true), measure)).hasLevel(OK);
    }
}
Also used : MetricType(org.sonar.server.computation.task.projectanalysis.metric.Metric.MetricType) Measure(org.sonar.server.computation.task.projectanalysis.measure.Measure) Metric(org.sonar.server.computation.task.projectanalysis.metric.Metric) Test(org.junit.Test)

Example 2 with MetricType

use of org.sonar.server.computation.task.projectanalysis.metric.Metric.MetricType in project sonarqube by SonarSource.

the class ConditionEvaluatorTest method condition_is_always_ok_when_measure_is_noValue.

@Test
public void condition_is_always_ok_when_measure_is_noValue() {
    for (MetricType metricType : from(asList(values())).filter(not(in(ImmutableSet.of(DATA, LEVEL))))) {
        Metric metric = createMetric(metricType);
        Measure measure = newMeasureBuilder().createNoValue();
        assertThat(underTest.evaluate(createErrorCondition(metric, EQUALS, "10.2"), measure)).hasLevel(OK);
    }
}
Also used : MetricType(org.sonar.server.computation.task.projectanalysis.metric.Metric.MetricType) Measure(org.sonar.server.computation.task.projectanalysis.measure.Measure) Metric(org.sonar.server.computation.task.projectanalysis.metric.Metric) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Measure (org.sonar.server.computation.task.projectanalysis.measure.Measure)2 Metric (org.sonar.server.computation.task.projectanalysis.metric.Metric)2 MetricType (org.sonar.server.computation.task.projectanalysis.metric.Metric.MetricType)2