From d942133d4218549c6dc689bd6abb35e3a11d505a Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Mon, 7 Jul 2014 09:48:06 +0200 Subject: [PATCH] Add a Medium Test when activating a rule with param having no default value (Ignored because it has to be fix) --- .../RuleActivatorMediumTest.java | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/sonar-server/src/test/java/org/sonar/server/qualityprofile/RuleActivatorMediumTest.java b/sonar-server/src/test/java/org/sonar/server/qualityprofile/RuleActivatorMediumTest.java index c26899f1576..3e1f5ae6c50 100644 --- a/sonar-server/src/test/java/org/sonar/server/qualityprofile/RuleActivatorMediumTest.java +++ b/sonar-server/src/test/java/org/sonar/server/qualityprofile/RuleActivatorMediumTest.java @@ -20,10 +20,7 @@ package org.sonar.server.qualityprofile; import com.google.common.collect.ImmutableMap; -import org.junit.After; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; +import org.junit.*; import org.sonar.api.rule.RuleKey; import org.sonar.api.rule.RuleStatus; import org.sonar.api.rule.Severity; @@ -45,6 +42,7 @@ import org.sonar.server.search.QueryOptions; import org.sonar.server.tester.ServerTester; import javax.annotation.Nullable; + import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -161,6 +159,26 @@ public class RuleActivatorMediumTest { assertThat(changes.get(0).getType()).isEqualTo(ActiveRuleChange.Type.UPDATED); } + @Test + @Ignore + public void update_activation_with_parameter_without_default_value() throws Exception { + // initial activation + RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); + activation.setSeverity(Severity.BLOCKER); + activate(activation, XOO_P1_KEY); + + // update + RuleActivation update = new RuleActivation(RuleTesting.XOO_X1); + // parameter min has no default value + update.setParameter("min", "42"); + List changes = activate(update, XOO_P1_KEY); + + assertThat(countActiveRules(XOO_P1_KEY)).isEqualTo(1); + verifyHasActiveRule(ActiveRuleKey.of(XOO_P1_KEY, RuleTesting.XOO_X1), Severity.BLOCKER, null, ImmutableMap.of("min", "42")); + assertThat(changes).hasSize(1); + assertThat(changes.get(0).getType()).isEqualTo(ActiveRuleChange.Type.UPDATED); + } + @Test public void update_activation_but_new_parameter() throws Exception { // initial activation -- 2.39.5