use of org.sonar.server.computation.task.projectanalysis.measure.Measure in project sonarqube by SonarSource.
the class ConditionEvaluatorTest method testNotEquals_BOOL.
@Test
public void testNotEquals_BOOL() {
Metric metric = createMetric(BOOL);
Measure measure = newMeasureBuilder().create(false, null);
assertThat(underTest.evaluate(createErrorCondition(metric, NOT_EQUALS, "1"), measure)).hasLevel(ERROR).hasValue(false);
assertThat(underTest.evaluate(createErrorCondition(metric, NOT_EQUALS, "0"), measure)).hasLevel(OK).hasValue(false);
}
use of org.sonar.server.computation.task.projectanalysis.measure.Measure in project sonarqube by SonarSource.
the class ConditionEvaluatorTest method testNotEquals_Level.
@Test
public void testNotEquals_Level() {
Metric metric = createMetric(LEVEL);
Measure measure = newMeasureBuilder().create(ERROR);
assertThat(underTest.evaluate(createErrorCondition(metric, NOT_EQUALS, OK.name()), measure)).hasLevel(ERROR).hasValue(ERROR.name());
}
use of org.sonar.server.computation.task.projectanalysis.measure.Measure in project sonarqube by SonarSource.
the class ConditionEvaluatorTest method testEquals_BOOL.
@Test
public void testEquals_BOOL() {
Metric metric = createMetric(BOOL);
Measure measure = newMeasureBuilder().create(false, null);
assertThat(underTest.evaluate(createErrorCondition(metric, EQUALS, "1"), measure)).hasLevel(OK).hasValue(false);
assertThat(underTest.evaluate(createErrorCondition(metric, EQUALS, "0"), measure)).hasLevel(ERROR).hasValue(false);
}
use of org.sonar.server.computation.task.projectanalysis.measure.Measure in project sonarqube by SonarSource.
the class ConditionEvaluatorTest method condition_on_period_without_value_is_OK.
@Test
public void condition_on_period_without_value_is_OK() {
Metric metric = createMetric(FLOAT);
Measure measure = newMeasureBuilder().createNoValue();
assertThat(underTest.evaluate(new Condition(metric, GREATER_THAN.getDbValue(), "3", null, true), measure)).hasLevel(OK).hasValue(null);
}
use of org.sonar.server.computation.task.projectanalysis.measure.Measure 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);
}
}
Aggregations