From 23830d07ed51853724dc660fff187c9e5aa4b36a Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Fri, 10 Sep 2010 13:04:24 +0000 Subject: * rename RuleProvider to RuleFinder * deprecate some classes in the rule API * add the parameter ValidationMessages to ProfileDefinition.createPrototype() --- .../test/java/org/sonar/plugins/checkstyle/SonarWayProfileTest.java | 6 +++++- .../sonar/plugins/checkstyle/SonarWayWithFindbugsProfileTest.java | 6 ++++-- .../org/sonar/plugins/checkstyle/SunConventionsProfileTest.java | 6 +++++- 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/SonarWayProfileTest.java b/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/SonarWayProfileTest.java index 4bce25c4af8..697a9c6685c 100644 --- a/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/SonarWayProfileTest.java +++ b/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/SonarWayProfileTest.java @@ -22,7 +22,9 @@ package org.sonar.plugins.checkstyle; import org.junit.Test; import org.sonar.api.profiles.ProfileDefinition; import org.sonar.api.profiles.ProfilePrototype; +import org.sonar.api.utils.ValidationMessages; +import static org.hamcrest.core.Is.is; import static org.hamcrest.number.OrderingComparisons.greaterThan; import static org.junit.Assert.assertThat; @@ -31,8 +33,10 @@ public class SonarWayProfileTest { @Test public void create() { ProfileDefinition sonarWay = new SonarWayProfile(); - ProfilePrototype prototype = sonarWay.createPrototype(); + ValidationMessages validation = ValidationMessages.create(); + ProfilePrototype prototype = sonarWay.createPrototype(validation); assertThat(prototype.getRulesByRepositoryKey(CheckstyleConstants.REPOSITORY_KEY).size(), greaterThan(1)); + assertThat(validation.hasErrors(), is(false)); } } diff --git a/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/SonarWayWithFindbugsProfileTest.java b/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/SonarWayWithFindbugsProfileTest.java index 98d2b7a996e..ae6513bbfa2 100644 --- a/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/SonarWayWithFindbugsProfileTest.java +++ b/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/SonarWayWithFindbugsProfileTest.java @@ -19,8 +19,10 @@ */ package org.sonar.plugins.checkstyle; +import org.hamcrest.core.Is; import org.junit.Test; import org.sonar.api.profiles.ProfilePrototype; +import org.sonar.api.utils.ValidationMessages; import static org.junit.Assert.assertThat; import static org.hamcrest.CoreMatchers.is; @@ -29,8 +31,8 @@ public class SonarWayWithFindbugsProfileTest { @Test public void sameAsSonarWay() { - ProfilePrototype withFindbugs = new SonarWayWithFindbugsProfile().createPrototype(); - ProfilePrototype withoutFindbugs = new SonarWayProfile().createPrototype(); + ProfilePrototype withFindbugs = new SonarWayWithFindbugsProfile().createPrototype(ValidationMessages.create()); + ProfilePrototype withoutFindbugs = new SonarWayProfile().createPrototype(ValidationMessages.create()); assertThat(withFindbugs.getRules().size(), is(withoutFindbugs.getRules().size())); } } diff --git a/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/SunConventionsProfileTest.java b/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/SunConventionsProfileTest.java index 28c82ac350e..73eaa38e8e8 100644 --- a/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/SunConventionsProfileTest.java +++ b/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/SunConventionsProfileTest.java @@ -19,9 +19,11 @@ */ package org.sonar.plugins.checkstyle; +import org.hamcrest.core.Is; import org.junit.Test; import org.sonar.api.profiles.ProfileDefinition; import org.sonar.api.profiles.ProfilePrototype; +import org.sonar.api.utils.ValidationMessages; import static org.hamcrest.Matchers.is; import static org.hamcrest.number.OrderingComparisons.greaterThan; @@ -31,10 +33,12 @@ public class SunConventionsProfileTest { @Test public void create() { ProfileDefinition sunConventionsProfile = new SunConventionsProfile(); - ProfilePrototype prototype = sunConventionsProfile.createPrototype(); + ValidationMessages validation = ValidationMessages.create(); + ProfilePrototype prototype = sunConventionsProfile.createPrototype(validation); assertThat(prototype.getRulesByRepositoryKey(CheckstyleConstants.REPOSITORY_KEY).size(), greaterThan(1)); assertThat( prototype.getRule(CheckstyleConstants.REPOSITORY_KEY, "com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck").getParameter("lineSeparator"), is("system")); + assertThat(validation.hasErrors(), Is.is(false)); } } -- cgit v1.2.3