diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-03-25 10:24:16 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-03-25 12:45:16 +0100 |
commit | 74abc65d43b9f5af2fd67a8c316c36afec4bed8d (patch) | |
tree | d378ed4ebdee816272ea0f46510afa2ab06c0c53 /plugins/sonar-cpd-plugin/src | |
parent | 9e4f4088f57a688e7865604ac3eef7153fc19eec (diff) | |
download | sonarqube-74abc65d43b9f5af2fd67a8c316c36afec4bed8d.tar.gz sonarqube-74abc65d43b9f5af2fd67a8c316c36afec4bed8d.zip |
SONAR-5154 A plugin should fail when using classes JavaFile or JavaPackage
Diffstat (limited to 'plugins/sonar-cpd-plugin/src')
-rw-r--r-- | plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/decorators/SumDuplicationsDecoratorTest.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/decorators/SumDuplicationsDecoratorTest.java b/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/decorators/SumDuplicationsDecoratorTest.java index c1af92310c4..7ebae1da257 100644 --- a/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/decorators/SumDuplicationsDecoratorTest.java +++ b/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/decorators/SumDuplicationsDecoratorTest.java @@ -23,8 +23,8 @@ import org.junit.Test; import org.sonar.api.batch.DecoratorContext; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Measure; -import org.sonar.api.resources.JavaFile; -import org.sonar.api.resources.Resource; +import org.sonar.api.resources.File; +import org.sonar.api.resources.Qualifiers; import org.sonar.api.test.IsMeasure; import static org.hamcrest.CoreMatchers.is; @@ -48,7 +48,8 @@ public class SumDuplicationsDecoratorTest { @Test public void doNotSetDuplicationsOnUnitTests() { SumDuplicationsDecorator decorator = new SumDuplicationsDecorator(); - Resource unitTest = new JavaFile("org.foo.BarTest", true); + File unitTest = new File("org/foo/BarTest.java"); + unitTest.setQualifier(Qualifiers.UNIT_TEST_FILE); DecoratorContext context = mock(DecoratorContext.class); decorator.decorate(unitTest, context); @@ -59,10 +60,10 @@ public class SumDuplicationsDecoratorTest { @Test public void saveZeroIfNoDuplications() { SumDuplicationsDecorator decorator = new SumDuplicationsDecorator(); - Resource unitTest = new JavaFile("org.foo.BarTest", false); + File file = new File("org/foo/BarTest.java"); DecoratorContext context = mock(DecoratorContext.class); - decorator.decorate(unitTest, context); + decorator.decorate(file, context); verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.DUPLICATED_LINES, 0.0))); } |