diff options
author | Aurelien Poscia <aurelien.poscia@sonarsource.com> | 2022-05-31 17:51:17 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-06-01 20:03:02 +0000 |
commit | fb40d278ce567ba246cd63985af9ed133214c1ce (patch) | |
tree | 35ba9bbcc6980bcf80aceb16b1483166efa4a6a6 | |
parent | 60d9c659e3c739c095ead0c20779b70605924565 (diff) | |
download | sonarqube-fb40d278ce567ba246cd63985af9ed133214c1ce.tar.gz sonarqube-fb40d278ce567ba246cd63985af9ed133214c1ce.zip |
SONAR-16397 fix show hotspot API endpoint's payload
2 files changed, 7 insertions, 7 deletions
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java index 44d5df3186f..33207c9977f 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java @@ -183,8 +183,8 @@ public class ShowAction implements HotspotsWsAction { Map<String, String> sectionKeyToContent = getSectionKeyToContent(ruleDto); 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(ROOT_CAUSE_SECTION_KEY)).ifPresent(ruleBuilder::setRiskDescription); + Optional.ofNullable(sectionKeyToContent.get(ASSESS_THE_PROBLEM_SECTION_KEY)).ifPresent(ruleBuilder::setVulnerabilityDescription); Optional.ofNullable(sectionKeyToContent.get(HOW_TO_FIX_SECTION_KEY)).ifPresent(ruleBuilder::setFixRecommendations); responseBuilder.setRule(ruleBuilder.build()); } diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java index 1cc2d5d8a0c..47d26b88f0c 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java @@ -464,8 +464,8 @@ public class ShowActionTest { Hotspots.ShowWsResponse response = newRequest(hotspot) .executeProtobuf(Hotspots.ShowWsResponse.class); - assertThat(response.getRule().getVulnerabilityDescription()).isEqualTo(rootCauseSection.getContent()); - assertThat(response.getRule().getRiskDescription()).isEqualTo(assesTheProblemSection.getContent()); + assertThat(response.getRule().getRiskDescription()).isEqualTo(rootCauseSection.getContent()); + assertThat(response.getRule().getVulnerabilityDescription()).isEqualTo(assesTheProblemSection.getContent()); assertThat(response.getRule().getFixRecommendations()).isEqualTo(howToFixSection.getContent()); } @@ -516,8 +516,8 @@ public class ShowActionTest { Hotspots.ShowWsResponse response = newRequest(hotspot) .executeProtobuf(Hotspots.ShowWsResponse.class); - assertThat(response.getRule().getVulnerabilityDescription()).isEqualTo(rootCauseSection.getContent()); - assertThat(response.getRule().getRiskDescription()).isEqualTo(assesTheProblemSection.getContent()); + assertThat(response.getRule().getRiskDescription()).isEqualTo(rootCauseSection.getContent()); + assertThat(response.getRule().getVulnerabilityDescription()).isEqualTo(assesTheProblemSection.getContent()); assertThat(response.getRule().getFixRecommendations()).isEmpty(); } @@ -540,7 +540,7 @@ public class ShowActionTest { RuleDescriptionSectionDto sectionDto = RuleDescriptionSectionDto.builder() .uuid(uuidFactory.create()) - .key(ASSESS_THE_PROBLEM_SECTION_KEY) + .key(DEFAULT_KEY) .content(description) .build(); |