Search in sources :

Example 6 with FooRule

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

the class SuppressWarningsTest method testLocalVariableLevelSuppression.

@Test
public void testLocalVariableLevelSuppression() {
    Report rpt = new Report();
    runTestFromString(TEST8, 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 7 with FooRule

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

the class SuppressWarningsTest method testNoSuppressionSomethingElseS.

@Test
public void testNoSuppressionSomethingElseS() {
    Report rpt = new Report();
    runTestFromString(TEST11, 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 8 with FooRule

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

the class SuppressWarningsTest method testMethodLevelSuppression.

@Test
public void testMethodLevelSuppression() {
    Report rpt = new Report();
    runTestFromString(TEST4, 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 9 with FooRule

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

the class SuppressWarningsTest method testSuppressAll.

@Test
public void testSuppressAll() {
    Report rpt = new Report();
    runTestFromString(TEST12, 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 10 with FooRule

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

the class SuppressWarningsTest method testSpecificSuppressionMulitpleValues2.

@Test
public void testSpecificSuppressionMulitpleValues2() {
    Report rpt = new Report();
    runTestFromString(TEST9_MULTIPLE_VALUES_2, 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)

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