use of org.sonar.db.measure.LiveMeasureDto in project sonarqube by SonarSource.
the class MeasureMatrixTest method setValue_String_does_nothing_if_value_is_not_changed.
@Test
public void setValue_String_does_nothing_if_value_is_not_changed() {
LiveMeasureDto measure = newMeasure(METRIC_1, PROJECT).setData("foo");
MeasureMatrix underTest = new MeasureMatrix(asList(PROJECT, FILE), asList(METRIC_1), asList(measure));
underTest.setValue(PROJECT, METRIC_1.getKey(), "foo");
assertThat(underTest.getMeasure(PROJECT, METRIC_1.getKey()).get().getDataAsString()).isEqualTo("foo");
assertThat(underTest.getChanged()).isEmpty();
}
use of org.sonar.db.measure.LiveMeasureDto in project sonarqube by SonarSource.
the class MeasureMatrixTest method getValue_returns_empty_if_measure_is_absent.
@Test
public void getValue_returns_empty_if_measure_is_absent() {
MetricDto metric = newMetricDto();
LiveMeasureDto measure = newMeasure(metric, PROJECT).setValue(null);
MeasureMatrix underTest = new MeasureMatrix(asList(PROJECT), asList(metric), asList(measure));
assertThat(underTest.getMeasure(FILE, metric.getKey())).isEmpty();
}
use of org.sonar.db.measure.LiveMeasureDto in project sonarqube by SonarSource.
the class MeasureMatrixTest method setValue_String_updates_value.
@Test
public void setValue_String_updates_value() {
LiveMeasureDto measure = newMeasure(METRIC_1, PROJECT).setData("foo");
MeasureMatrix underTest = new MeasureMatrix(asList(PROJECT, FILE), asList(METRIC_1), asList(measure));
underTest.setValue(PROJECT, METRIC_1.getKey(), "bar");
assertThat(underTest.getMeasure(PROJECT, METRIC_1.getKey()).get().getDataAsString()).isEqualTo("bar");
assertThat(underTest.getChanged()).extracting(LiveMeasureDto::getDataAsString).containsExactly("bar");
}
Aggregations