// Register the Jsp Scanner
parser.addScanner(new JspScanner("-j"));
parseAndAssertNodeCount(5);
// The first node should be an HTMLJspTag
assertTrue("Node 1 should be an HTMLJspTag", node[0] instanceof JspTag);
JspTag tag = (JspTag) node[0];
assertStringEquals(
"Contents of the tag",
"@ taglib uri=\"/WEB-INF/struts.tld\" prefix=\"struts\" ",
tag.getText());
// The second node should be a normal tag
assertTrue("Node 2 should be an Tag", node[1] instanceof Tag);
Tag htag = (Tag) node[1];
assertStringEquals(
"Contents of the tag",
"jsp:useBean id=\"transfer\" scope=\"session\" class=\"com.bank.PageBean\"",
htag.getText());
assertStringEquals(
"html",
"<JSP:USEBEAN ID=\"transfer\" SCOPE=\"session\" CLASS=\"com.bank.PageBean\"/>",
htag.toHtml());
// The third node should be an HTMLJspTag
assertTrue("Node 3 should be an HTMLJspTag", node[2] instanceof JspTag);
JspTag tag2 = (JspTag) node[2];
String expected =
"\r\n"
+ " org.apache.struts.util.BeanUtils.populate(transfer, request);\r\n"
+ " if(request.getParameter(\"marker\") == null)\r\n"
+ " // initialize a pseudo-property\r\n"
+ " transfer.set(\"days\", java.util.Arrays.asList(\r\n"
+ " new String[] {\"1\", \"2\", \"3\", \"4\", \"31\"}));\r\n"
+ " else \r\n"
+ " if(transfer.validate(request))\r\n"
+ " ";
assertEquals("Contents of the tag", expected, tag2.getText());
}