Search in sources :

Example 1 with TestDescriptor

use of net.sourceforge.pmd.testframework.TestDescriptor in project pmd by pmd.

the class ExcludeLinesTest method testAcceptance.

@Test
public void testAcceptance() {
    runTest(new TestDescriptor(TEST1, "NOPMD should work", 0, rule));
    runTest(new TestDescriptor(TEST2, "Should fail without exclude marker", 1, rule));
}
Also used : TestDescriptor(net.sourceforge.pmd.testframework.TestDescriptor) Test(org.junit.Test)

Example 2 with TestDescriptor

use of net.sourceforge.pmd.testframework.TestDescriptor in project pmd by pmd.

the class RegexpAcceptanceTest method testSimple.

@Test
public void testSimple() {
    Rule r = new XPathRule(XPATH);
    r.setLanguage(LanguageRegistry.getLanguage(JavaLanguageModule.NAME));
    r.setMessage("");
    TestDescriptor[] testDescriptors = extractTestsFromXml(r, "RegexpAcceptance");
    for (TestDescriptor testDescriptor : testDescriptors) {
        testDescriptor.setReinitializeRule(false);
    }
    runTests(testDescriptors);
}
Also used : XPathRule(net.sourceforge.pmd.lang.rule.XPathRule) Rule(net.sourceforge.pmd.Rule) XPathRule(net.sourceforge.pmd.lang.rule.XPathRule) TestDescriptor(net.sourceforge.pmd.testframework.TestDescriptor) Test(org.junit.Test)

Aggregations

TestDescriptor (net.sourceforge.pmd.testframework.TestDescriptor)2 Test (org.junit.Test)2 Rule (net.sourceforge.pmd.Rule)1 XPathRule (net.sourceforge.pmd.lang.rule.XPathRule)1