use of org.sonar.db.measure.MeasureDto in project sonarqube by SonarSource.
the class MeasureToMeasureDtoTest method toMeasureDto_maps_name_of_Level_to_data_and_has_no_value_for_LEVEL_metric.
@Test
public void toMeasureDto_maps_name_of_Level_to_data_and_has_no_value_for_LEVEL_metric() {
MeasureDto trueMeasureDto = underTest.toMeasureDto(Measure.newMeasureBuilder().create(Measure.Level.OK), SOME_LEVEL_METRIC, SOME_COMPONENT);
assertThat(trueMeasureDto.getValue()).isNull();
assertThat(trueMeasureDto.getData()).isEqualTo(Measure.Level.OK.name());
}
use of org.sonar.db.measure.MeasureDto in project sonarqube by SonarSource.
the class MeasureToMeasureDtoTest method toMeasureDto_returns_Dto_with_variation_if_Measure_has_MeasureVariations.
@Test
public void toMeasureDto_returns_Dto_with_variation_if_Measure_has_MeasureVariations() {
MeasureDto measureDto = underTest.toMeasureDto(Measure.newMeasureBuilder().setVariation(SOME_VARIATIONS).create(SOME_STRING), SOME_STRING_METRIC, SOME_COMPONENT);
assertThat(measureDto.getVariation()).isEqualTo(1d);
}
use of org.sonar.db.measure.MeasureDto in project sonarqube by SonarSource.
the class MeasureToMeasureDtoTest method toMeasureDto_set_componentId_and_snapshotId_from_method_arguments.
@Test
@UseDataProvider("all_types_Measures")
public void toMeasureDto_set_componentId_and_snapshotId_from_method_arguments(Measure measure, Metric metric) {
MeasureDto measureDto = underTest.toMeasureDto(measure, metric, SOME_COMPONENT);
assertThat(measureDto.getComponentUuid()).isEqualTo(SOME_COMPONENT.getUuid());
// assertThat(measureDto.getSnapshotId()).isEqualTo(SOME_SNAPSHOT_ID);
}
use of org.sonar.db.measure.MeasureDto in project sonarqube by SonarSource.
the class MeasureToMeasureDtoTest method toMeasureDto_returns_Dto_without_alertStatus_nor_alertText_if_Measure_has_no_QualityGateStatus.
@Test
@UseDataProvider("all_types_Measures")
public void toMeasureDto_returns_Dto_without_alertStatus_nor_alertText_if_Measure_has_no_QualityGateStatus(Measure measure, Metric metric) {
MeasureDto measureDto = underTest.toMeasureDto(measure, metric, SOME_COMPONENT);
assertThat(measureDto.getAlertStatus()).isNull();
assertThat(measureDto.getAlertText()).isNull();
}
use of org.sonar.db.measure.MeasureDto in project sonarqube by SonarSource.
the class MeasureToMeasureDtoTest method toMeasureDto_returns_Dto_with_alertStatus_and_alertText_if_Measure_has_QualityGateStatus.
@Test
public void toMeasureDto_returns_Dto_with_alertStatus_and_alertText_if_Measure_has_QualityGateStatus() {
String alertText = "some error";
MeasureDto measureDto = underTest.toMeasureDto(Measure.newMeasureBuilder().setQualityGateStatus(new QualityGateStatus(Measure.Level.ERROR, alertText)).create(SOME_STRING), SOME_STRING_METRIC, SOME_COMPONENT);
assertThat(measureDto.getAlertStatus()).isEqualTo(Measure.Level.ERROR.name());
assertThat(measureDto.getAlertText()).isEqualTo(alertText);
}
Aggregations