{
createParser(FORM_HTML, "http://www.google.com/test/index.html");
parser.addScanner(new FormScanner("", parser));
parseAndAssertNodeCount(1);
assertTrue("Node 0 should be Form Tag", node[0] instanceof FormTag);
FormTag formTag = (FormTag) node[0];
assertStringEquals("Method", FormTag.POST, formTag.getFormMethod());
assertStringEquals(
"Location",
"http://www.google.com/test/do_login.php",
formTag.getFormLocation());
assertStringEquals("Name", "login_form", formTag.getFormName());
InputTag nameTag = formTag.getInputTag("name");
InputTag passwdTag = formTag.getInputTag("passwd");
InputTag submitTag = formTag.getInputTag("submit");
InputTag dummyTag = formTag.getInputTag("dummy");
assertNotNull("Input Name Tag should not be null", nameTag);
assertNotNull("Input Password Tag should not be null", passwdTag);
assertNotNull("Input Submit Tag should not be null", submitTag);
assertNull("Input dummy tag should be null", dummyTag);
assertTypeNameSize("Input Name Tag", "text", "name", "20", nameTag);
assertTypeNameSize(
"Input Password Tag",
"password",
"passwd",
"20",
passwdTag);
assertTypeNameValue(
"Input Submit Tag",
"submit",
"submit",
"Login",
submitTag);
TextareaTag textAreaTag = formTag.getTextAreaTag("Description");
assertNotNull("Text Area Tag should have been found", textAreaTag);
assertEquals(
"Text Area Tag Contents",
"Contents of TextArea",
textAreaTag.getValue());
assertNull("Should have been null", formTag.getTextAreaTag("junk"));
assertStringEquals("toHTML", EXPECTED_FORM_HTML, formTag.toHtml());
}