]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-16397 Hotspot API: return default section in 'riskDescription' field instead...
authorAurelien Poscia <aurelien.poscia@sonarsource.com>
Wed, 25 May 2022 09:53:18 +0000 (11:53 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 25 May 2022 20:03:17 +0000 (20:03 +0000)
server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java

index 0658ce71649a7ce8a5a8a5478e86785f62a46571..44d5df3186ff495ce226f89857bac9d5be424546 100644 (file)
@@ -182,7 +182,7 @@ public class ShowAction implements HotspotsWsAction {
       .setVulnerabilityProbability(sqCategory.getVulnerability().name());
 
     Map<String, String> sectionKeyToContent = getSectionKeyToContent(ruleDto);
-    Optional.ofNullable(sectionKeyToContent.get(DEFAULT_KEY)).ifPresent(ruleBuilder::setVulnerabilityDescription);
+    Optional.ofNullable(sectionKeyToContent.get(DEFAULT_KEY)).ifPresent(ruleBuilder::setRiskDescription);
     Optional.ofNullable(sectionKeyToContent.get(ROOT_CAUSE_SECTION_KEY)).ifPresent(ruleBuilder::setVulnerabilityDescription);
     Optional.ofNullable(sectionKeyToContent.get(ASSESS_THE_PROBLEM_SECTION_KEY)).ifPresent(ruleBuilder::setRiskDescription);
     Optional.ofNullable(sectionKeyToContent.get(HOW_TO_FIX_SECTION_KEY)).ifPresent(ruleBuilder::setFixRecommendations);
index 7e4146efb2cdc080ed675d0cad0b9295dd1db890..1cc2d5d8a0ce030e5b271fdaf2c750fefa720d01 100644 (file)
@@ -488,8 +488,8 @@ public class ShowActionTest {
     Hotspots.ShowWsResponse response = newRequest(hotspot)
       .executeProtobuf(Hotspots.ShowWsResponse.class);
 
-    assertThat(response.getRule().getVulnerabilityDescription()).isEqualTo(introductionSection.getContent());
-    assertThat(response.getRule().getRiskDescription()).isEmpty();
+    assertThat(response.getRule().getRiskDescription()).isEqualTo(introductionSection.getContent());
+    assertThat(response.getRule().getVulnerabilityDescription()).isEmpty();
     assertThat(response.getRule().getFixRecommendations()).isEmpty();
   }