Search in sources :

Example 11 with FooRule

use of net.sourceforge.pmd.FooRule in project pmd by pmd.

the class SuppressWarningsTest method testConstructorLevelSuppression.

@Test
public void testConstructorLevelSuppression() {
    Report rpt = new Report();
    runTestFromString(TEST5, new FooRule(), rpt, LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("1.5"));
    assertEquals(0, rpt.size());
}
Also used : FooRule(net.sourceforge.pmd.FooRule) Report(net.sourceforge.pmd.Report) Test(org.junit.Test)

Example 12 with FooRule

use of net.sourceforge.pmd.FooRule in project pmd by pmd.

the class SuppressWarningsTest method testClassLevelSuppression.

@Test
public void testClassLevelSuppression() {
    Report rpt = new Report();
    runTestFromString(TEST1, new FooRule(), rpt, LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("1.5"));
    assertEquals(0, rpt.size());
    runTestFromString(TEST2, new FooRule(), rpt, LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("1.5"));
    assertEquals(0, rpt.size());
}
Also used : FooRule(net.sourceforge.pmd.FooRule) Report(net.sourceforge.pmd.Report) Test(org.junit.Test)

Example 13 with FooRule

use of net.sourceforge.pmd.FooRule in project pmd by pmd.

the class SuppressWarningsTest method testNoSuppressionBlank.

@Test
public void testNoSuppressionBlank() {
    Report rpt = new Report();
    runTestFromString(TEST10, new FooRule(), rpt, LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("1.5"));
    assertEquals(2, rpt.size());
}
Also used : FooRule(net.sourceforge.pmd.FooRule) Report(net.sourceforge.pmd.Report) Test(org.junit.Test)

Example 14 with FooRule

use of net.sourceforge.pmd.FooRule in project pmd by pmd.

the class SuppressWarningsTest method testParameterLevelSuppression.

@Test
public void testParameterLevelSuppression() {
    Report rpt = new Report();
    runTestFromString(TEST7, new FooRule(), rpt, LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("1.5"));
    assertEquals(1, rpt.size());
}
Also used : FooRule(net.sourceforge.pmd.FooRule) Report(net.sourceforge.pmd.Report) Test(org.junit.Test)

Example 15 with FooRule

use of net.sourceforge.pmd.FooRule in project pmd by pmd.

the class SuppressWarningsTest method testSpecificSuppressionValue1.

@Test
public void testSpecificSuppressionValue1() {
    Report rpt = new Report();
    runTestFromString(TEST9_VALUE1, new FooRule(), rpt, LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("1.5"));
    assertEquals(1, rpt.size());
}
Also used : FooRule(net.sourceforge.pmd.FooRule) Report(net.sourceforge.pmd.Report) Test(org.junit.Test)

Aggregations

FooRule (net.sourceforge.pmd.FooRule)21 Report (net.sourceforge.pmd.Report)19 Test (org.junit.Test)18 RuleContext (net.sourceforge.pmd.RuleContext)4 ParametricRuleViolation (net.sourceforge.pmd.lang.rule.ParametricRuleViolation)4 DummyNode (net.sourceforge.pmd.lang.ast.DummyNode)3 ReportTest (net.sourceforge.pmd.ReportTest)2 HashMap (java.util.HashMap)1 ConfigurationError (net.sourceforge.pmd.Report.ConfigurationError)1 RuleViolation (net.sourceforge.pmd.RuleViolation)1 Node (net.sourceforge.pmd.lang.ast.Node)1