Search in sources :

Example 1 with RuleWithProperties

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

the class AbstractRendererTst method testRuleWithProperties.

@Test
public void testRuleWithProperties() throws Exception {
    DummyNode node = createNode(1);
    RuleContext ctx = new RuleContext();
    ctx.setSourceCodeFilename(getSourceCodeFilename());
    Report report = new Report();
    RuleWithProperties theRule = new RuleWithProperties();
    theRule.setProperty(RuleWithProperties.STRING_PROPERTY_DESCRIPTOR, "the string value\nsecond line with \"quotes\"");
    report.addRuleViolation(new ParametricRuleViolation<Node>(theRule, ctx, node, "blah"));
    String rendered = ReportTest.render(getRenderer(), report);
    assertEquals(filter(getExpectedWithProperties()), filter(rendered));
}
Also used : RuleContext(net.sourceforge.pmd.RuleContext) Report(net.sourceforge.pmd.Report) DummyNode(net.sourceforge.pmd.lang.ast.DummyNode) Node(net.sourceforge.pmd.lang.ast.Node) DummyNode(net.sourceforge.pmd.lang.ast.DummyNode) RuleWithProperties(net.sourceforge.pmd.RuleWithProperties) Test(org.junit.Test) ReportTest(net.sourceforge.pmd.ReportTest)

Aggregations

Report (net.sourceforge.pmd.Report)1 ReportTest (net.sourceforge.pmd.ReportTest)1 RuleContext (net.sourceforge.pmd.RuleContext)1 RuleWithProperties (net.sourceforge.pmd.RuleWithProperties)1 DummyNode (net.sourceforge.pmd.lang.ast.DummyNode)1 Node (net.sourceforge.pmd.lang.ast.Node)1 Test (org.junit.Test)1