From 12b488c80a45f27b5176557a9c7e1a24dcab83d4 Mon Sep 17 00:00:00 2001 From: Aurelien Poscia Date: Fri, 8 Jul 2022 16:45:08 +0200 Subject: [PATCH] SONAR-16614 adapt test to new constraints enforced by sonar-plugin-api --- .../java/org/sonar/server/rule/RegisterRulesTest.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java index fb6fb316b6c..3144162449b 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java @@ -746,6 +746,7 @@ public class RegisterRulesTest { RuleDescriptionSection section1context1 = createRuleDescriptionSection(HOW_TO_FIX_SECTION_KEY, "section1 ctx1 content", "CTX_1"); RuleDescriptionSection section1context2 = createRuleDescriptionSection(HOW_TO_FIX_SECTION_KEY,"section1 ctx2 content", "CTX_2"); RuleDescriptionSection section2context1 = createRuleDescriptionSection(RESOURCES_SECTION_KEY,"section2 content", "CTX_1"); + RuleDescriptionSection section2context2 = createRuleDescriptionSection(RESOURCES_SECTION_KEY,"section2 ctx2 content", "CTX_2"); RuleDescriptionSection section3noContext = createRuleDescriptionSection(ASSESS_THE_PROBLEM_SECTION_KEY,"section3 content", null); RuleDescriptionSection section4noContext = createRuleDescriptionSection(ROOT_CAUSE_SECTION_KEY,"section4 content", null); execute(context -> { @@ -755,6 +756,7 @@ public class RegisterRulesTest { .addDescriptionSection(section1context1) .addDescriptionSection(section1context2) .addDescriptionSection(section2context1) + .addDescriptionSection(section2context2) .addDescriptionSection(section3noContext) .addDescriptionSection(section4noContext) .setHtmlDescription("Desc1"); @@ -763,7 +765,8 @@ public class RegisterRulesTest { RuleDescriptionSection section1context2updated = createRuleDescriptionSection(HOW_TO_FIX_SECTION_KEY, "section1 ctx2 updated content", "CTX_2"); RuleDescriptionSection section2updatedWithoutContext = createRuleDescriptionSection(RESOURCES_SECTION_KEY, section2context1.getHtmlContent(), null); - RuleDescriptionSection section4updatedWithContext = createRuleDescriptionSection(ROOT_CAUSE_SECTION_KEY, section4noContext.getHtmlContent(), "CTX_1"); + RuleDescriptionSection section4updatedWithContext1 = createRuleDescriptionSection(ROOT_CAUSE_SECTION_KEY, section4noContext.getHtmlContent(), "CTX_1"); + RuleDescriptionSection section4updatedWithContext2 = createRuleDescriptionSection(ROOT_CAUSE_SECTION_KEY, section4noContext.getHtmlContent(), "CTX_2"); system.setNow(DATE2.getTime()); execute(context -> { NewRepository repo = context.createRepository("fake", "java"); @@ -773,7 +776,8 @@ public class RegisterRulesTest { .addDescriptionSection(section1context2updated) .addDescriptionSection(section2updatedWithoutContext) .addDescriptionSection(section3noContext) - .addDescriptionSection(section4updatedWithContext) + .addDescriptionSection(section4updatedWithContext1) + .addDescriptionSection(section4updatedWithContext2) .setHtmlDescription("Desc2"); repo.done(); @@ -784,7 +788,7 @@ public class RegisterRulesTest { assertThat(rule1.getDefaultRuleDescriptionSection().getContent()).isEqualTo("Desc2"); Set expectedSections = Set.of(section1context1, section1context2updated, - section2updatedWithoutContext, section3noContext, section4updatedWithContext); + section2updatedWithoutContext, section3noContext, section4updatedWithContext1, section4updatedWithContext2); assertThat(rule1.getRuleDescriptionSectionDtos()).hasSize(expectedSections.size() + 1); expectedSections.forEach(apiSection -> assertSectionExists(apiSection, rule1.getRuleDescriptionSectionDtos())); } -- 2.39.5