1 package test.net.sourceforge.pmd.jsp.rules;
2
3 import net.sourceforge.pmd.Rule;
4 import net.sourceforge.pmd.RuleSetFactory;
5 import net.sourceforge.pmd.SourceType;
6 import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst;
7 import test.net.sourceforge.pmd.testframework.TestDescriptor;
8
9 /***
10 * Test the "DontNestJsfInJstlIteration" rule.
11 *
12 * @author pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be
13 */
14 public class DontNestJsfInJstlIterationTest extends SimpleAggregatorTst {
15
16 public void testViolation() throws Exception {
17 Rule rule = new RuleSetFactory()
18 .createSingleRuleSet("rulesets/basic-jsf.xml").getRuleByName("DontNestJsfInJstlIteration");
19
20 runTests(new TestDescriptor[]{
21 new TestDescriptor(VIOLATION, "A violation.", 1, rule)
22 }, SourceType.JSP);
23 }
24
25 private static final String VIOLATION
26 = "<html> <body> <ul> <c:forEach items='${books}' var='b'>"
27 + "<li> <h:outputText value='#{b}' /> </li>"
28 + "</c:forEach> </ul> </body> </html>";
29 }