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.RuleSetNotFoundException; 6 import net.sourceforge.pmd.SourceType; 7 import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst; 8 import test.net.sourceforge.pmd.testframework.TestDescriptor; 9 10 public class NoClassAttributeTest extends SimpleAggregatorTst { 11 12 public void testAll() throws RuleSetNotFoundException { 13 Rule rule = new RuleSetFactory() 14 .createSingleRuleSet("rulesets/basic-jsp.xml").getRuleByName("NoClassAttribute"); 15 runTests(new TestDescriptor[]{ 16 new TestDescriptor(VIOLATION1, "A class attribute.", 1, rule), 17 new TestDescriptor(NO_VIOLATION1, "No scriptlets.", 0, rule), 18 }, SourceType.JSP); 19 } 20 21 private static final String VIOLATION1 = 22 "<HTML> <BODY>" + 23 "<P class='MajorHeading'>Some text</P>" + 24 "</BODY> </HTML>"; 25 26 27 private static final String NO_VIOLATION1 = 28 "<html><body><p>text</p></body></html>"; 29 }