Search in sources :

Example 11 with MetricImpl

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

the class CustomMeasuresCopyStepTest method test_float_value_type.

@Test
public void test_float_value_type() throws Exception {
    CustomMeasureDto dto = new CustomMeasureDto();
    dto.setValue(10.0);
    assertThat(dtoToMeasure(dto, new MetricImpl(1, "m", "M", Metric.MetricType.FLOAT)).getDoubleValue()).isEqualTo(10.0);
}
Also used : MetricImpl(org.sonar.server.computation.task.projectanalysis.metric.MetricImpl) CustomMeasureDto(org.sonar.db.measure.custom.CustomMeasureDto) Test(org.junit.Test)

Example 12 with MetricImpl

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

the class CustomMeasuresCopyStepTest method test_percent_value_type.

@Test
public void test_percent_value_type() throws Exception {
    CustomMeasureDto dto = new CustomMeasureDto();
    dto.setValue(10.0);
    assertThat(dtoToMeasure(dto, new MetricImpl(1, "m", "M", Metric.MetricType.PERCENT)).getDoubleValue()).isEqualTo(10);
}
Also used : MetricImpl(org.sonar.server.computation.task.projectanalysis.metric.MetricImpl) CustomMeasureDto(org.sonar.db.measure.custom.CustomMeasureDto) Test(org.junit.Test)

Example 13 with MetricImpl

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

the class CustomMeasuresCopyStepTest method test_string_value_type.

@Test
public void test_string_value_type() throws Exception {
    CustomMeasureDto dto = new CustomMeasureDto();
    dto.setTextValue("foo");
    assertThat(dtoToMeasure(dto, new MetricImpl(1, "m", "M", Metric.MetricType.STRING)).getStringValue()).isEqualTo("foo");
}
Also used : MetricImpl(org.sonar.server.computation.task.projectanalysis.metric.MetricImpl) CustomMeasureDto(org.sonar.db.measure.custom.CustomMeasureDto) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)13 MetricImpl (org.sonar.server.computation.task.projectanalysis.metric.MetricImpl)13 CustomMeasureDto (org.sonar.db.measure.custom.CustomMeasureDto)7 Metric (org.sonar.server.computation.task.projectanalysis.metric.Metric)4 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)2 MeasureDto (org.sonar.db.measure.MeasureDto)1 Condition (org.sonar.server.computation.task.projectanalysis.qualitygate.Condition)1