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 IframeMissingSrcAttributeTest extends SimpleAggregatorTst {
9
10 private Rule rule;
11
12 public void setUp() {
13 rule = findRule("jsp", "IframeMissingSrcAttribute");
14 }
15
16 public void testAll() {
17 runTests(new TestDescriptor[]{
18 new TestDescriptor(TEST1_OK, "1, iframe exists with src attribute", 0, rule),
19 new TestDescriptor(TEST2_FAIL, "2, iframe is missing src attribute", 1, rule),
20 new TestDescriptor(TEST3_FAIL, "3, IFRAME is missing src attribute", 1, rule),
21 }, SourceType.JSP);
22 }
23
24 private static final String TEST1_OK =
25 "<html><body><iframe src=\"foo.html\"></iframe></body></html>";
26
27 private static final String TEST2_FAIL =
28 "<html><body><iframe></iframe></body></html>";
29
30 private static final String TEST3_FAIL =
31 "<html><body><IFRAME></IFRAME></body></html>";
32 }