1   package test.net.sourceforge.pmd.jsp.rules;
2   
3   import net.sourceforge.pmd.Rule;
4   import net.sourceforge.pmd.SourceType;
5   import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst;
6   import test.net.sourceforge.pmd.testframework.TestDescriptor;
7   
8   public class NoHtmlCommentsTest extends SimpleAggregatorTst {
9   
10      private Rule rule;
11  
12      public void setUp() {
13          rule = findRule("jsp", "NoHtmlComments");
14      }
15  
16      public void testAll() {
17          runTests(new TestDescriptor[]{
18              new TestDescriptor(TEST1_OK, "No HTML comments", 0, rule),
19              new TestDescriptor(TEST2_FAIL, "HTML Comment", 1, rule),
20              new TestDescriptor(TEST3_OK, "JSP Comments", 0, rule),
21          }, SourceType.JSP);
22      }
23  
24      private static final String TEST1_OK =
25              "<html><body></body></html>";
26  
27      private static final String TEST2_FAIL =
28          "<html><body><!-- HTML Comment --></body></html>";
29  
30      private static final String TEST3_OK =
31          "<html><body><%-- JSP Comment --%></body></html>";
32  }