summaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/test/java/org
diff options
context:
space:
mode:
authorJenkins CI <ci@sonarsource.com>2012-07-26 23:51:08 +0200
committerJenkins CI <ci@sonarsource.com>2012-07-26 23:51:08 +0200
commit79fc401307e2484f7d46cc6d92877dc7a0ac3868 (patch)
tree4a6e2fb3ac114f1f0872872905d4c6f9d0f62156 /sonar-plugin-api/src/test/java/org
parent8cf9ce7f62e6eb028f811b6049ed6ae00c176fbc (diff)
parent84c0fbaa08bc8f5db140e26395a37ce27568cb27 (diff)
downloadsonarqube-79fc401307e2484f7d46cc6d92877dc7a0ac3868.tar.gz
sonarqube-79fc401307e2484f7d46cc6d92877dc7a0ac3868.zip
Automatic merge from branch-3.2
Diffstat (limited to 'sonar-plugin-api/src/test/java/org')
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotationRuleParserTest.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotationRuleParserTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotationRuleParserTest.java
index 2fa2b5c30de..74877514357 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotationRuleParserTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotationRuleParserTest.java
@@ -19,11 +19,10 @@
*/
package org.sonar.api.rules;
-import org.sonar.api.utils.SonarException;
-
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.PropertyType;
+import org.sonar.api.utils.SonarException;
import org.sonar.check.IsoCategory;
import org.sonar.check.Priority;
@@ -116,6 +115,18 @@ public class AnnotationRuleParserTest {
}
@Test
+ public void overridden_rule() {
+ List<Rule> rules = parseAnnotatedClass(OverridingRule.class);
+ assertThat(rules).hasSize(1);
+ Rule rule = rules.get(0);
+ assertThat(rule.getKey()).isEqualTo("overriding_foo");
+ assertThat(rule.getName()).isEqualTo("Overriding Foo");
+ assertThat(rule.getDescription()).isNull();
+ assertThat(rule.getSeverity()).isEqualTo(RulePriority.MAJOR);
+ assertThat(rule.getParams()).hasSize(2);
+ }
+
+ @Test
public void supportDeprecatedAnnotations() {
List<Rule> rules = parseAnnotatedClass(Check.class);
assertThat(rules).hasSize(1);
@@ -141,19 +152,25 @@ public class AnnotationRuleParserTest {
@org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", priority = Priority.BLOCKER)
static class RuleWithProperty {
@org.sonar.check.RuleProperty(description = "Ignore ?", defaultValue = "false")
- public String property;
+ private String property;
+ }
+
+ @org.sonar.check.Rule(key = "overriding_foo", name = "Overriding Foo")
+ static class OverridingRule extends RuleWithProperty {
+ @org.sonar.check.RuleProperty
+ private String additionalProperty;
}
@org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", priority = Priority.BLOCKER)
static class RuleWithIntegerProperty {
@org.sonar.check.RuleProperty(description = "Max", defaultValue = "12")
- public Integer property;
+ private Integer property;
}
@org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", priority = Priority.BLOCKER)
static class RuleWithTextProperty {
@org.sonar.check.RuleProperty(description = "text", defaultValue = "Long text", type = "TEXT")
- public String property;
+ protected String property;
}
@org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", priority = Priority.BLOCKER)