use of org.sonarqube.ws.Measures.Measure in project sonarqube by SonarSource.
the class SearchActionTest method return_measures_on_application.
@Test
public void return_measures_on_application() {
ComponentDto application = db.components().insertPrivateApplication();
userSession.addProjectPermission(UserRole.USER, application);
MetricDto coverage = db.measures().insertMetric(m -> m.setValueType(FLOAT.name()));
db.measures().insertLiveMeasure(application, coverage, m -> m.setValue(15.5d));
SearchWsResponse result = call(singletonList(application.getDbKey()), singletonList(coverage.getKey()));
List<Measure> measures = result.getMeasuresList();
assertThat(measures).hasSize(1);
Measure measure = measures.get(0);
assertThat(measure.getMetric()).isEqualTo(coverage.getKey());
assertThat(measure.getValue()).isEqualTo("15.5");
}
use of org.sonarqube.ws.Measures.Measure in project sonarqube by SonarSource.
the class SearchActionTest method return_measures_on_sub_view.
@Test
public void return_measures_on_sub_view() {
ComponentDto view = db.components().insertPrivatePortfolio();
ComponentDto subView = db.components().insertComponent(newSubPortfolio(view));
userSession.addProjectPermission(UserRole.USER, subView);
MetricDto metric = db.measures().insertMetric(m -> m.setValueType(FLOAT.name()));
db.measures().insertLiveMeasure(subView, metric, m -> m.setValue(15.5d));
SearchWsResponse result = call(singletonList(subView.getDbKey()), singletonList(metric.getKey()));
List<Measure> measures = result.getMeasuresList();
assertThat(measures).hasSize(1);
Measure measure = measures.get(0);
assertThat(measure.getMetric()).isEqualTo(metric.getKey());
assertThat(measure.getValue()).isEqualTo("15.5");
}
Aggregations