diff options
author | Godin <mandrikov@gmail.com> | 2010-12-08 19:22:18 +0000 |
---|---|---|
committer | Godin <mandrikov@gmail.com> | 2010-12-08 19:22:18 +0000 |
commit | 85ad745aaee19225e0abbb11abd167e39a8b1e95 (patch) | |
tree | 37139954f8e33512388964ae4f4059666745c5cf /plugins/sonar-checkstyle-plugin | |
parent | e3b4152afad73825c08a72c7e17432fb97638970 (diff) | |
download | sonarqube-85ad745aaee19225e0abbb11abd167e39a8b1e95.tar.gz sonarqube-85ad745aaee19225e0abbb11abd167e39a8b1e95.zip |
SONAR-1809: Export / import alerts attached to a quality profile
Diffstat (limited to 'plugins/sonar-checkstyle-plugin')
3 files changed, 7 insertions, 4 deletions
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 23a39650517..fef7df549a4 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,6 +22,7 @@ package org.sonar.plugins.checkstyle; import org.junit.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.sonar.api.measures.MetricFinder; import org.sonar.api.profiles.ProfileDefinition; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.profiles.XMLProfileParser; @@ -40,7 +41,7 @@ public class SonarWayProfileTest { @Test public void shouldCreateProfile() { - ProfileDefinition sonarWay = new SonarWayProfile(new XMLProfileParser(newRuleFinder())); + ProfileDefinition sonarWay = new SonarWayProfile(new XMLProfileParser(newRuleFinder(), mock(MetricFinder.class))); ValidationMessages validation = ValidationMessages.create(); RulesProfile profile = sonarWay.createProfile(validation); assertThat(profile.getActiveRulesByRepository(CheckstyleConstants.REPOSITORY_KEY).size(), greaterThan(1)); @@ -49,7 +50,7 @@ public class SonarWayProfileTest { private RuleFinder newRuleFinder() { RuleFinder ruleFinder = mock(RuleFinder.class); - when(ruleFinder.findByKey(anyString(), anyString())).thenAnswer(new Answer<Rule>(){ + when(ruleFinder.findByKey(anyString(), anyString())).thenAnswer(new Answer<Rule>() { public Rule answer(InvocationOnMock iom) throws Throwable { return Rule.create((String) iom.getArguments()[0], (String) iom.getArguments()[1], (String) iom.getArguments()[1]); } 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 d5af6c0b236..c53eff084ca 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 @@ -22,6 +22,7 @@ package org.sonar.plugins.checkstyle; import org.junit.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.sonar.api.measures.MetricFinder; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.profiles.XMLProfileParser; import org.sonar.api.rules.Rule; @@ -39,7 +40,7 @@ public class SonarWayWithFindbugsProfileTest { @Test public void shouldBeSameAsSonarWay() { RuleFinder ruleFinder = newRuleFinder(); - SonarWayProfile sonarWay = new SonarWayProfile(new XMLProfileParser(ruleFinder)); + SonarWayProfile sonarWay = new SonarWayProfile(new XMLProfileParser(ruleFinder, mock(MetricFinder.class))); RulesProfile withoutFindbugs = sonarWay.createProfile(ValidationMessages.create()); RulesProfile withFindbugs = new SonarWayWithFindbugsProfile(sonarWay).createProfile(ValidationMessages.create()); assertThat(withFindbugs.getActiveRules().size(), is(withoutFindbugs.getActiveRules().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 147006e30eb..4f2bb9361d8 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 @@ -23,6 +23,7 @@ import org.hamcrest.core.Is; import org.junit.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.sonar.api.measures.MetricFinder; import org.sonar.api.profiles.ProfileDefinition; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.profiles.XMLProfileParser; @@ -39,7 +40,7 @@ import static org.mockito.Mockito.when; public class SunConventionsProfileTest { @Test public void shouldCreateProfile() { - ProfileDefinition definition = new SunConventionsProfile(new XMLProfileParser(newRuleFinder())); + ProfileDefinition definition = new SunConventionsProfile(new XMLProfileParser(newRuleFinder(), mock(MetricFinder.class))); ValidationMessages validation = ValidationMessages.create(); RulesProfile sunProfile = definition.createProfile(validation); assertThat(sunProfile.getActiveRulesByRepository(CheckstyleConstants.REPOSITORY_KEY).size(), greaterThan(1)); |