import com.google.common.collect.HashMultiset;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Multiset;
+import com.google.gson.Gson;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;
import org.sonar.api.issue.IssueStatus;
import org.sonar.api.issue.impact.Severity;
+import org.sonar.api.issue.impact.SoftwareQuality;
import org.sonar.api.rules.RuleType;
import org.sonar.ce.task.projectanalysis.component.Component;
import org.sonar.ce.task.projectanalysis.measure.Measure;
import static org.sonar.api.measures.CoreMetrics.FALSE_POSITIVE_ISSUES_KEY;
import static org.sonar.api.measures.CoreMetrics.HIGH_IMPACT_ACCEPTED_ISSUES_KEY;
import static org.sonar.api.measures.CoreMetrics.INFO_VIOLATIONS_KEY;
+import static org.sonar.api.measures.CoreMetrics.MAINTAINABILITY_ISSUES;
import static org.sonar.api.measures.CoreMetrics.MAJOR_VIOLATIONS_KEY;
import static org.sonar.api.measures.CoreMetrics.MINOR_VIOLATIONS_KEY;
import static org.sonar.api.measures.CoreMetrics.NEW_ACCEPTED_ISSUES_KEY;
import static org.sonar.api.measures.CoreMetrics.NEW_VIOLATIONS_KEY;
import static org.sonar.api.measures.CoreMetrics.NEW_VULNERABILITIES_KEY;
import static org.sonar.api.measures.CoreMetrics.OPEN_ISSUES_KEY;
+import static org.sonar.api.measures.CoreMetrics.RELIABILITY_ISSUES;
import static org.sonar.api.measures.CoreMetrics.REOPENED_ISSUES_KEY;
import static org.sonar.api.measures.CoreMetrics.SECURITY_HOTSPOTS_KEY;
+import static org.sonar.api.measures.CoreMetrics.SECURITY_ISSUES;
import static org.sonar.api.measures.CoreMetrics.VIOLATIONS_KEY;
import static org.sonar.api.measures.CoreMetrics.VULNERABILITIES_KEY;
import static org.sonar.api.rule.Severity.BLOCKER;
* <li>issues per resolution (unresolved, false-positives, won't fix)</li>
* <li>issues per severity (from info to blocker)</li>
* <li>issues per type (code smell, bug, vulnerability, security hotspots)</li>
+ * <li>issues per impact</li>
* </ul>
* For each value, the variation on configured periods is also computed.
*/
MINOR, NEW_MINOR_VIOLATIONS_KEY,
INFO, NEW_INFO_VIOLATIONS_KEY);
+ static final Map<String, String> IMPACT_TO_METRIC_KEY = Map.of(
+ SoftwareQuality.SECURITY.name(), SECURITY_ISSUES.key(),
+ SoftwareQuality.RELIABILITY.name(), RELIABILITY_ISSUES.key(),
+ SoftwareQuality.MAINTAINABILITY.name(), MAINTAINABILITY_ISSUES.key());
+
private static final Map<RuleType, String> TYPE_TO_METRIC_KEY = ImmutableMap.<RuleType, String>builder()
.put(CODE_SMELL, CODE_SMELLS_KEY)
.put(BUG, BUGS_KEY)
.put(SECURITY_HOTSPOT, NEW_SECURITY_HOTSPOTS_KEY)
.build();
+ private static final Gson gson = new Gson();
+
private final MetricRepository metricRepository;
private final MeasureRepository measureRepository;
private final NewIssueClassifier newIssueClassifier;
addMeasuresBySeverity(component);
addMeasuresByStatus(component);
addMeasuresByType(component);
+ addMeasuresByImpact(component);
addNewMeasures(component);
currentCounters = null;
}
addMeasure(component, HIGH_IMPACT_ACCEPTED_ISSUES_KEY, currentCounters.counter().highImpactAccepted);
}
+ private void addMeasuresByImpact(Component component) {
+ for (Map.Entry<String, Map<String, Long>> impactEntry : currentCounters.counter().impactsBag.entrySet()) {
+ String json = gson.toJson(impactEntry.getValue());
+ addMeasure(component, IMPACT_TO_METRIC_KEY.get(impactEntry.getKey()), json);
+ }
+ }
+
private void addMeasuresByType(Component component) {
for (Map.Entry<RuleType, String> entry : TYPE_TO_METRIC_KEY.entrySet()) {
addMeasure(component, entry.getValue(), currentCounters.counter().typeBag.count(entry.getKey()));
measureRepository.add(component, metric, Measure.newMeasureBuilder().create(value));
}
+ private void addMeasure(Component component, String metricKey, String data) {
+ Metric metric = metricRepository.getByKey(metricKey);
+ measureRepository.add(component, metric, Measure.newMeasureBuilder().create(data));
+ }
+
private void addNewMeasures(Component component) {
if (!newIssueClassifier.isEnabled()) {
return;
}
/**
- * Count issues by status, resolutions, rules and severities
+ * Count issues by status, resolutions, rules, impacts and severities
*/
private static class Counter {
private int unresolved = 0;
private int accepted = 0;
private int highImpactAccepted = 0;
private final Multiset<String> severityBag = HashMultiset.create();
+ /**
+ * This map contains the number of issues per software quality along with their distribution based on (new) severity.
+ */
+ private final Map<String, Map<String, Long>> impactsBag = new HashMap<>();
private final EnumMultiset<RuleType> typeBag = EnumMultiset.create(RuleType.class);
+ public Counter() {
+ initImpactsBag();
+ }
+
+ private void initImpactsBag() {
+ for (SoftwareQuality quality : SoftwareQuality.values()) {
+ Map<String, Long> severityMap = new HashMap<>();
+ for (Severity severity : Severity.values()) {
+ severityMap.put(severity.name(), 0L);
+ }
+ severityMap.put("total", 0L);
+ impactsBag.put(quality.name(), severityMap);
+ }
+ }
+
void add(Counter counter) {
unresolved += counter.unresolved;
open += counter.open;
highImpactAccepted += counter.highImpactAccepted;
severityBag.addAll(counter.severityBag);
typeBag.addAll(counter.typeBag);
+
+ // Add impacts
+ for (Map.Entry<String, Map<String, Long>> impactEntry : counter.impactsBag.entrySet()) {
+ Map<String, Long> severityMap = impactsBag.get(impactEntry.getKey());
+ for (Map.Entry<String, Long> severityEntry : impactEntry.getValue().entrySet()) {
+ severityMap.compute(severityEntry.getKey(), (key, value) -> value + severityEntry.getValue());
+ }
+ }
}
void add(DefaultIssue issue) {
default:
// Other statuses are ignored
}
+ addIssueToImpactsBag(issue);
+ }
+
+ private void addIssueToImpactsBag(DefaultIssue issue) {
+ if (IssueStatus.OPEN == issue.issueStatus() || IssueStatus.CONFIRMED == issue.issueStatus()) {
+ for (Map.Entry<SoftwareQuality, Severity> impact : issue.impacts().entrySet()) {
+ impactsBag.compute(impact.getKey().name(), (key, value) -> {
+ value.compute(impact.getValue().name(), (severity, count) -> count == null ? 1 : count + 1);
+ value.compute("total", (total, count) -> count == null ? 1 : count + 1);
+ return value;
+ });
+ }
+ }
}
}
*/
package org.sonar.ce.task.projectanalysis.issue;
+import com.google.gson.Gson;
+import java.lang.constant.Constable;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.assertj.core.data.MapEntry;
import org.junit.Rule;
import org.sonar.ce.task.projectanalysis.batch.BatchReportReaderRule;
import org.sonar.ce.task.projectanalysis.component.Component;
import org.sonar.ce.task.projectanalysis.component.TreeRootHolderRule;
+import org.sonar.ce.task.projectanalysis.measure.Measure;
import org.sonar.ce.task.projectanalysis.measure.MeasureRepoEntry;
import org.sonar.ce.task.projectanalysis.measure.MeasureRepositoryRule;
import org.sonar.ce.task.projectanalysis.metric.MetricRepositoryRule;
import static org.sonar.api.issue.Issue.STATUS_OPEN;
import static org.sonar.api.issue.Issue.STATUS_RESOLVED;
import static org.sonar.api.issue.impact.Severity.HIGH;
+import static org.sonar.api.issue.impact.Severity.LOW;
import static org.sonar.api.issue.impact.Severity.MEDIUM;
import static org.sonar.api.measures.CoreMetrics.ACCEPTED_ISSUES;
import static org.sonar.api.measures.CoreMetrics.ACCEPTED_ISSUES_KEY;
import static org.sonar.api.measures.CoreMetrics.HIGH_IMPACT_ACCEPTED_ISSUES;
import static org.sonar.api.measures.CoreMetrics.HIGH_IMPACT_ACCEPTED_ISSUES_KEY;
import static org.sonar.api.measures.CoreMetrics.INFO_VIOLATIONS;
+import static org.sonar.api.measures.CoreMetrics.MAINTAINABILITY_ISSUES;
import static org.sonar.api.measures.CoreMetrics.MAJOR_VIOLATIONS;
import static org.sonar.api.measures.CoreMetrics.MAJOR_VIOLATIONS_KEY;
import static org.sonar.api.measures.CoreMetrics.MINOR_VIOLATIONS;
import static org.sonar.api.measures.CoreMetrics.NEW_VULNERABILITIES_KEY;
import static org.sonar.api.measures.CoreMetrics.OPEN_ISSUES;
import static org.sonar.api.measures.CoreMetrics.OPEN_ISSUES_KEY;
+import static org.sonar.api.measures.CoreMetrics.RELIABILITY_ISSUES;
import static org.sonar.api.measures.CoreMetrics.REOPENED_ISSUES;
import static org.sonar.api.measures.CoreMetrics.SECURITY_HOTSPOTS;
import static org.sonar.api.measures.CoreMetrics.SECURITY_HOTSPOTS_KEY;
+import static org.sonar.api.measures.CoreMetrics.SECURITY_ISSUES;
import static org.sonar.api.measures.CoreMetrics.VIOLATIONS;
import static org.sonar.api.measures.CoreMetrics.VIOLATIONS_KEY;
import static org.sonar.api.measures.CoreMetrics.VULNERABILITIES;
import static org.sonar.api.rules.RuleType.CODE_SMELL;
import static org.sonar.api.rules.RuleType.SECURITY_HOTSPOT;
import static org.sonar.ce.task.projectanalysis.component.ReportComponent.builder;
+import static org.sonar.ce.task.projectanalysis.issue.IssueCounter.IMPACT_TO_METRIC_KEY;
import static org.sonar.ce.task.projectanalysis.measure.Measure.newMeasureBuilder;
import static org.sonar.ce.task.projectanalysis.measure.MeasureRepoEntry.entryOf;
.add(NEW_VULNERABILITIES)
.add(NEW_SECURITY_HOTSPOTS)
.add(NEW_ACCEPTED_ISSUES)
- .add(HIGH_IMPACT_ACCEPTED_ISSUES);
+ .add(HIGH_IMPACT_ACCEPTED_ISSUES)
+ .add(RELIABILITY_ISSUES)
+ .add(MAINTAINABILITY_ISSUES)
+ .add(SECURITY_ISSUES);
@Rule
public MeasureRepositoryRule measureRepository = MeasureRepositoryRule.create(treeRootHolder, metricRepository);
underTest.beforeComponent(PROJECT);
underTest.afterComponent(PROJECT);
- assertValues(FILE1, entry(NEW_VIOLATIONS_KEY, 2), entry(NEW_CRITICAL_VIOLATIONS_KEY, 2), entry(NEW_BLOCKER_VIOLATIONS_KEY, 0), entry(NEW_MAJOR_VIOLATIONS_KEY, 0),
+ assertIntValue(FILE1, entry(NEW_VIOLATIONS_KEY, 2), entry(NEW_CRITICAL_VIOLATIONS_KEY, 2), entry(NEW_BLOCKER_VIOLATIONS_KEY, 0), entry(NEW_MAJOR_VIOLATIONS_KEY, 0),
entry(NEW_CODE_SMELLS_KEY, 1), entry(NEW_BUGS_KEY, 1), entry(NEW_VULNERABILITIES_KEY, 0), entry(NEW_SECURITY_HOTSPOTS_KEY, 1));
- assertValues(PROJECT, entry(NEW_VIOLATIONS_KEY, 2), entry(NEW_CRITICAL_VIOLATIONS_KEY, 2), entry(NEW_BLOCKER_VIOLATIONS_KEY, 0), entry(NEW_MAJOR_VIOLATIONS_KEY, 0),
+ assertIntValue(PROJECT, entry(NEW_VIOLATIONS_KEY, 2), entry(NEW_CRITICAL_VIOLATIONS_KEY, 2), entry(NEW_BLOCKER_VIOLATIONS_KEY, 0), entry(NEW_MAJOR_VIOLATIONS_KEY, 0),
entry(NEW_CODE_SMELLS_KEY, 1), entry(NEW_BUGS_KEY, 1), entry(NEW_VULNERABILITIES_KEY, 0), entry(NEW_SECURITY_HOTSPOTS_KEY, 1));
}
underTest.beforeComponent(PROJECT);
underTest.afterComponent(PROJECT);
- assertValues(FILE1, entry(NEW_VIOLATIONS_KEY, 1), entry(NEW_ACCEPTED_ISSUES_KEY, 2), entry(NEW_SECURITY_HOTSPOTS_KEY, 1));
- assertValues(PROJECT, entry(NEW_VIOLATIONS_KEY, 1), entry(NEW_ACCEPTED_ISSUES_KEY, 2), entry(NEW_SECURITY_HOTSPOTS_KEY, 1));
+ assertIntValue(FILE1, entry(NEW_VIOLATIONS_KEY, 1), entry(NEW_ACCEPTED_ISSUES_KEY, 2), entry(NEW_SECURITY_HOTSPOTS_KEY, 1));
+ assertIntValue(PROJECT, entry(NEW_VIOLATIONS_KEY, 1), entry(NEW_ACCEPTED_ISSUES_KEY, 2), entry(NEW_SECURITY_HOTSPOTS_KEY, 1));
+ }
+
+ @Test
+ public void count_impacts() {
+ when(newIssueClassifier.isEnabled()).thenReturn(true);
+
+ underTest.beforeComponent(FILE1);
+ underTest.onIssue(FILE1, createIssue(RESOLUTION_WONT_FIX, STATUS_OPEN, SoftwareQuality.MAINTAINABILITY, HIGH));
+ underTest.onIssue(FILE1, createIssue(RESOLUTION_WONT_FIX, STATUS_OPEN, SoftwareQuality.MAINTAINABILITY, MEDIUM));
+
+ underTest.onIssue(FILE1, createNewIssue(RESOLUTION_WONT_FIX, STATUS_OPEN, SoftwareQuality.MAINTAINABILITY, HIGH));
+ underTest.onIssue(FILE1, createNewIssue(RESOLUTION_WONT_FIX, STATUS_RESOLVED, SoftwareQuality.MAINTAINABILITY, HIGH));
+ underTest.onIssue(FILE1, createNewIssue(RESOLUTION_WONT_FIX, STATUS_OPEN, SoftwareQuality.MAINTAINABILITY, MEDIUM));
+
+ underTest.onIssue(FILE1, createIssue(RESOLUTION_WONT_FIX, STATUS_OPEN, SoftwareQuality.SECURITY, HIGH));
+ underTest.onIssue(FILE1, createIssue(RESOLUTION_WONT_FIX, STATUS_OPEN, SoftwareQuality.SECURITY, MEDIUM));
+
+ underTest.onIssue(FILE1, createNewSecurityHotspot());
+ underTest.afterComponent(FILE1);
+
+ underTest.beforeComponent(PROJECT);
+ underTest.afterComponent(PROJECT);
+
+ Set<Map.Entry<String, Measure>> entries = measureRepository.getRawMeasures(FILE1).entrySet();
+
+ assertSoftwareQualityMeasures(SoftwareQuality.MAINTAINABILITY, Map.of(HIGH, 2, MEDIUM, 2, LOW, 0, "total", 4), entries);
+ assertSoftwareQualityMeasures(SoftwareQuality.SECURITY, Map.of(HIGH, 1, MEDIUM, 1, LOW, 0, "total", 2), entries);
+ assertSoftwareQualityMeasures(SoftwareQuality.RELIABILITY, Map.of(HIGH, 0, MEDIUM, 0, LOW, 0, "total", 0), entries);
+ }
+
+ private void assertSoftwareQualityMeasures(SoftwareQuality softwareQuality, Map<? extends Constable, Integer> expectedRaw,
+ Set<Map.Entry<String, Measure>> actualRaw) {
+ Map<String, Long> expectedMap = expectedRaw.entrySet().stream().collect(Collectors.toMap(k -> k.getKey().toString(), v -> v.getValue().longValue()));
+
+ Map.Entry<String, Measure> softwareQualityMap = actualRaw.stream()
+ .filter(e -> e.getKey().equals(IMPACT_TO_METRIC_KEY.get(softwareQuality.name())))
+ .findFirst()
+ .get();
+
+ assertThat(softwareQualityMap.getValue().getData()).isEqualTo(new Gson().toJson(expectedMap));
}
@Test
underTest.beforeComponent(PROJECT);
underTest.afterComponent(PROJECT);
- assertValues(FILE1, entry(VIOLATIONS_KEY, 2), entry(NEW_VIOLATIONS_KEY, 1), entry(NEW_ACCEPTED_ISSUES_KEY, 3),
+ assertIntValue(FILE1, entry(VIOLATIONS_KEY, 2), entry(NEW_VIOLATIONS_KEY, 1), entry(NEW_ACCEPTED_ISSUES_KEY, 3),
entry(HIGH_IMPACT_ACCEPTED_ISSUES_KEY, 3));
- assertValues(PROJECT, entry(VIOLATIONS_KEY, 2), entry(NEW_VIOLATIONS_KEY, 1), entry(NEW_ACCEPTED_ISSUES_KEY, 3),
+ assertIntValue(PROJECT, entry(VIOLATIONS_KEY, 2), entry(NEW_VIOLATIONS_KEY, 1), entry(NEW_ACCEPTED_ISSUES_KEY, 3),
entry(HIGH_IMPACT_ACCEPTED_ISSUES_KEY, 3));
}
underTest.beforeComponent(PROJECT);
underTest.afterComponent(PROJECT);
- assertValues(FILE1, entry(NEW_VIOLATIONS_KEY, 0), entry(NEW_CRITICAL_VIOLATIONS_KEY, 0), entry(NEW_BLOCKER_VIOLATIONS_KEY, 0), entry(NEW_MAJOR_VIOLATIONS_KEY, 0),
+ assertIntValue(FILE1, entry(NEW_VIOLATIONS_KEY, 0), entry(NEW_CRITICAL_VIOLATIONS_KEY, 0), entry(NEW_BLOCKER_VIOLATIONS_KEY, 0), entry(NEW_MAJOR_VIOLATIONS_KEY, 0),
entry(NEW_VULNERABILITIES_KEY, 0));
- assertValues(PROJECT, entry(NEW_VIOLATIONS_KEY, 0), entry(NEW_CRITICAL_VIOLATIONS_KEY, 0), entry(NEW_BLOCKER_VIOLATIONS_KEY, 0), entry(NEW_MAJOR_VIOLATIONS_KEY, 0),
+ assertIntValue(PROJECT, entry(NEW_VIOLATIONS_KEY, 0), entry(NEW_CRITICAL_VIOLATIONS_KEY, 0), entry(NEW_BLOCKER_VIOLATIONS_KEY, 0), entry(NEW_MAJOR_VIOLATIONS_KEY, 0),
entry(NEW_VULNERABILITIES_KEY, 0));
}
@SafeVarargs
- private final void assertValues(Component componentRef, MapEntry<String, Integer>... entries) {
+ private void assertIntValue(Component componentRef, MapEntry<String, Integer>... entries) {
assertThat(measureRepository.getRawMeasures(componentRef).entrySet()
.stream()
+ .filter(e -> e.getValue().getValueType() == Measure.ValueType.INT)
.map(e -> entry(e.getKey(), e.getValue().getIntValue())))
.contains(entries);
}
@SafeVarargs
- private final void assertMeasures(Component componentRef, Map.Entry<String, Integer>... entries) {
+ private void assertMeasures(Component componentRef, Map.Entry<String, Integer>... entries) {
List<MeasureRepoEntry> expected = stream(entries)
.map(e -> entryOf(e.getKey(), newMeasureBuilder().create(e.getValue())))
.toList();
}
private DefaultIssue createNewIssue(@Nullable String resolution, String status, Severity impactSeverity) {
+ return createNewIssue(resolution, status, SoftwareQuality.MAINTAINABILITY, impactSeverity);
+ }
+
+ private DefaultIssue createNewIssue(@Nullable String resolution, String status, SoftwareQuality softwareQuality, Severity impactSeverity) {
DefaultIssue issue = createNewIssue(resolution, status, MAJOR, CODE_SMELL);
issue.addImpact(SoftwareQuality.MAINTAINABILITY, impactSeverity);
return issue;
}
private static DefaultIssue createIssue(@Nullable String resolution, String status, Severity impactSeverity) {
+ return createIssue(resolution, status, SoftwareQuality.MAINTAINABILITY, impactSeverity);
+ }
+
+ private static DefaultIssue createIssue(@Nullable String resolution, String status, SoftwareQuality softwareQuality, Severity impactSeverity) {
DefaultIssue issue = createIssue(resolution, status, MAJOR, CODE_SMELL);
- issue.addImpact(SoftwareQuality.MAINTAINABILITY, impactSeverity);
+ issue.addImpact(softwareQuality, impactSeverity);
return issue;
}
*/
package org.sonar.server.measure.ws;
+import com.google.gson.Gson;
+import java.util.Map;
import org.junit.Rule;
import org.junit.Test;
import org.sonar.api.server.ws.WebService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.tuple;
+import static org.sonar.api.measures.CoreMetrics.RELIABILITY_ISSUES;
import static org.sonar.api.measures.Metric.ValueType.INT;
import static org.sonar.api.utils.DateUtils.parseDateTime;
import static org.sonar.api.web.UserRole.USER;
import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_KEYS;
import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_PULL_REQUEST;
import static org.sonar.test.JsonAssert.assertJson;
+import static org.sonarqube.ws.Common.ImpactSeverity.HIGH;
+import static org.sonarqube.ws.Common.ImpactSeverity.LOW;
+import static org.sonarqube.ws.Common.ImpactSeverity.MEDIUM;
public class ComponentActionIT {
ProjectData projectData = db.components().insertPrivateProject(p -> p.setEnabled(false));
ComponentDto mainBranch = projectData.getMainBranchComponent();
userSession.addProjectPermission(USER, projectData.getProjectDto());
- userSession.addProjectPermission(USER, projectData.getProjectDto());
MetricDto metric = db.measures().insertMetric(m -> m.setValueType("INT"));
assertThatThrownBy(() -> {
.hasMessage(String.format("Component '%s' on branch '%s' not found", file.getKey(), "another_branch"));
}
+ @Test
+ public void should_return_data_type_measure() {
+ ProjectData projectData = db.components().insertPrivateProject(p -> p.setKey("MY_PROJECT").setName("My Project"));
+ userSession.addProjectPermission(USER, projectData.getProjectDto()).registerBranches(projectData.getMainBranchDto());
+ ComponentDto mainBranch = projectData.getMainBranchComponent();
+ SnapshotDto analysis = db.components().insertSnapshot(mainBranch, s -> s.setPeriodDate(parseDateTime("2016-01-11T10:49:50+0100").getTime())
+ .setPeriodMode("previous_version")
+ .setPeriodParam("1.0-SNAPSHOT"));
+
+ MetricDto metric = db.measures().insertMetric(m -> m.setValueType("DATA")
+ .setShortName(RELIABILITY_ISSUES.getName())
+ .setKey(RELIABILITY_ISSUES.getKey())
+ .setBestValue(null)
+ .setWorstValue(null));
+
+ Map<String, Long> reliabilityIssuesMap = Map.of(HIGH.name(), 1L, MEDIUM.name(), 2L, LOW.name(), 3L, "total", 6L);
+ String expectedJson = new Gson().toJson(reliabilityIssuesMap);
+ db.measures().insertLiveMeasure(mainBranch, metric, m -> m.setData(expectedJson));
+
+ db.commit();
+
+ ComponentWsResponse response = newRequest(projectData.projectKey(), RELIABILITY_ISSUES.getKey());
+ String json = response.getComponent().getMeasures(0).getValue();
+
+ assertThat(json).isEqualTo(expectedJson);
+ }
+
@Test
public void shouldReturnRenamedMetric() {
ProjectData projectData = db.components().insertPrivateProject(p -> p.setKey("MY_PROJECT")