View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.renderers;
5   
6   import net.sourceforge.pmd.FooRule;
7   import net.sourceforge.pmd.Report;
8   import net.sourceforge.pmd.ReportTest;
9   import net.sourceforge.pmd.RuleContext;
10  import net.sourceforge.pmd.RuleViolation;
11  import net.sourceforge.pmd.lang.ast.DummyNode;
12  import net.sourceforge.pmd.lang.ast.Node;
13  import net.sourceforge.pmd.lang.rule.ParametricRuleViolation;
14  
15  import org.junit.Assert;
16  import org.junit.Test;
17  
18  public class XSLTRendererTest {
19  
20      @Test
21      public void testDefaultStylesheet() throws Exception {
22          XSLTRenderer renderer = new XSLTRenderer();
23          Report report = new Report();
24          DummyNode node = new DummyNode(1);
25          node.testingOnly__setBeginLine(1);
26          node.testingOnly__setBeginColumn(1);
27          RuleViolation rv = new ParametricRuleViolation<Node>(new FooRule(), new RuleContext(),
28                  node, "violation message");
29          report.addRuleViolation(rv);
30          String result = ReportTest.render(renderer, report);
31          Assert.assertTrue(result.contains("violation message"));
32      }
33  }