use of org.sonar.server.computation.task.projectanalysis.measure.Measure in project sonarqube by SonarSource.
the class ConditionEvaluatorTest method testEquals_work_duration.
@Test
public void testEquals_work_duration() {
Metric metric = createMetric(WORK_DUR);
Measure measure = newMeasureBuilder().create(60l, null);
assertThat(underTest.evaluate(createErrorCondition(metric, EQUALS, "60"), measure)).hasLevel(ERROR);
}
use of org.sonar.server.computation.task.projectanalysis.measure.Measure in project sonarqube by SonarSource.
the class ConditionEvaluatorTest method testNotEquals_for_double.
@Test
public void testNotEquals_for_double() {
Metric metric = createMetric(FLOAT);
Measure measure = newMeasureBuilder().create(10.2d, 1, null);
assertThat(underTest.evaluate(createErrorCondition(metric, NOT_EQUALS, "10.2"), measure)).hasLevel(OK).hasValue(10.2d);
assertThat(underTest.evaluate(createErrorCondition(metric, NOT_EQUALS, "10.1"), measure)).hasLevel(ERROR).hasValue(10.2d);
}
use of org.sonar.server.computation.task.projectanalysis.measure.Measure in project sonarqube by SonarSource.
the class ConditionEvaluatorTest method getLevel_throws_IEA_if_error_threshold_is_not_parsable_boolean.
@Test
public void getLevel_throws_IEA_if_error_threshold_is_not_parsable_boolean() {
Metric metric = createMetric(BOOL);
Measure measure = newMeasureBuilder().create(false, null);
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("Quality Gate: Unable to parse value 'polop' to compare against name");
underTest.evaluate(createErrorCondition(metric, EQUALS, "polop"), measure);
}
use of org.sonar.server.computation.task.projectanalysis.measure.Measure in project sonarqube by SonarSource.
the class ConditionEvaluatorTest method getLevel_throws_IEA_if_error_threshold_is_not_parsable_long.
@Test
public void getLevel_throws_IEA_if_error_threshold_is_not_parsable_long() {
Metric metric = createMetric(WORK_DUR);
Measure measure = newMeasureBuilder().create(60l, null);
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("Quality Gate: Unable to parse value 'polop' to compare against name");
underTest.evaluate(createErrorCondition(metric, EQUALS, "polop"), measure);
}
use of org.sonar.server.computation.task.projectanalysis.measure.Measure in project sonarqube by SonarSource.
the class ConditionEvaluatorTest method testGreater.
@Test
public void testGreater() {
Metric metric = createMetric(FLOAT);
Measure measure = newMeasureBuilder().create(10.2d, 1, null);
assertThat(underTest.evaluate(createErrorCondition(metric, GREATER_THAN, "10.1"), measure)).hasLevel(ERROR).hasValue(10.2d);
assertThat(underTest.evaluate(createErrorCondition(metric, GREATER_THAN, "10.2"), measure)).hasLevel(OK).hasValue(10.2d);
assertThat(underTest.evaluate(createErrorCondition(metric, GREATER_THAN, "10.3"), measure)).hasLevel(OK).hasValue(10.2d);
}
Aggregations