Thread: [Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/tagTests LabelTagTest.java, 1.1, 1.2 FormTagTe
Brought to you by:
derrickoswald
From: Derrick O. <der...@us...> - 2006-06-06 02:45:53
|
Update of //cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv19487/src/org/htmlparser/tests/tagTests Modified Files: LabelTagTest.java FormTagTest.java LinkTagTest.java ObjectCollectionTest.java BodyTagTest.java Log Message: Eliminate deprecated classes and methods. Removed nodeDecorator package, StringNodeFactory, LinkProcesor, SpecialHashTable, and methods for linkData, non-Ex Attributes and FindAllNodesThatAre. Index: FormTagTest.java =================================================================== RCS file: //cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/FormTagTest.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** FormTagTest.java 27 May 2006 14:03:52 -0000 1.48 --- FormTagTest.java 4 Jun 2006 19:17:20 -0000 1.49 *************** *** 297,308 **** ); ((PrototypicalNodeFactory)parser.getNodeFactory ()).unregisterTag (new FormTag ()); ! Node [] nodes = ! parser.extractAllNodesThatAre( FormTag.class ! ); assertEquals( ! "shouldnt have found form tag", 0, ! nodes.length ); } --- 297,308 ---- ); ((PrototypicalNodeFactory)parser.getNodeFactory ()).unregisterTag (new FormTag ()); ! NodeList nodes = ! parser.extractAllNodesThatMatch (new NodeClassFilter ( FormTag.class ! )); assertEquals( ! "shouldn't have found form tag", 0, ! nodes.size () ); } *************** *** 436,442 **** ); FormTag formTag = ! (FormTag)(parser.extractAllNodesThatAre( FormTag.class ! )[0]); assertNotNull("Should have found a form tag",formTag); assertStringEquals("name","form0",formTag.getFormName()); --- 436,442 ---- ); FormTag formTag = ! (FormTag)(parser.extractAllNodesThatMatch (new NodeClassFilter ( FormTag.class ! )).elementAt (0)); assertNotNull("Should have found a form tag",formTag); assertStringEquals("name","form0",formTag.getFormName()); *************** *** 503,509 **** createParser (html); formTag = ! (FormTag)(parser.extractAllNodesThatAre ( FormTag.class ! )[0]); assertNotNull ("Should have found a form tag",formTag); assertStringEquals ("name", "searchForm", formTag.getFormName ()); --- 503,509 ---- createParser (html); formTag = ! (FormTag)(parser.extractAllNodesThatMatch (new NodeClassFilter ( FormTag.class ! )).elementAt (0)); assertNotNull ("Should have found a form tag",formTag); assertStringEquals ("name", "searchForm", formTag.getFormName ()); *************** *** 554,560 **** createParser (html); formTag = ! (FormTag)(parser.extractAllNodesThatAre ( FormTag.class ! )[0]); assertNotNull ("Should have found a form tag",formTag); nl = formTag.getFormInputs (); --- 554,560 ---- createParser (html); formTag = ! (FormTag)(parser.extractAllNodesThatMatch (new NodeClassFilter ( FormTag.class ! )).elementAt (0)); assertNotNull ("Should have found a form tag",formTag); nl = formTag.getFormInputs (); Index: LabelTagTest.java =================================================================== RCS file: //cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/LabelTagTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LabelTagTest.java 7 Dec 2003 23:41:43 -0000 1.1 --- LabelTagTest.java 4 Jun 2006 19:17:20 -0000 1.2 *************** *** 101,106 **** LabelTag labelTag = (LabelTag) node[0]; assertStringEquals("Label", html, labelTag.toHtml()); ! Hashtable attr = labelTag.getAttributes(); ! assertNull("ID",attr.get("id")); } --- 101,105 ---- LabelTag labelTag = (LabelTag) node[0]; assertStringEquals("Label", html, labelTag.toHtml()); ! assertNull("ID",labelTag.getAttribute("id")); } *************** *** 117,122 **** labelTag = (LabelTag) node[1]; assertStringEquals("Label", label2 + "</label>",labelTag.toHtml()); ! Hashtable attr = labelTag.getAttributes(); ! assertNull("ID",attr.get("id")); } --- 116,120 ---- labelTag = (LabelTag) node[1]; assertStringEquals("Label", label2 + "</label>",labelTag.toHtml()); ! assertNull("ID",labelTag.getAttribute("id")); } Index: LinkTagTest.java =================================================================== RCS file: //cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/LinkTagTest.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** LinkTagTest.java 12 Nov 2005 16:44:54 -0000 1.53 --- LinkTagTest.java 4 Jun 2006 19:17:20 -0000 1.54 *************** *** 31,34 **** --- 31,35 ---- import org.htmlparser.Tag; import org.htmlparser.Text; + import org.htmlparser.filters.NodeClassFilter; import org.htmlparser.tags.HeadTag; import org.htmlparser.tags.Html; *************** *** 36,39 **** --- 37,41 ---- import org.htmlparser.tags.LinkTag; import org.htmlparser.tests.ParserTestCase; + import org.htmlparser.util.NodeList; import org.htmlparser.util.ParserException; import org.htmlparser.util.SimpleNodeIterator; *************** *** 412,419 **** "<a href=s/7509><b>Yahoo! Movies</b></a>" + "</td>","http://www.yahoo.com"); ! Node linkNodes [] = parser.extractAllNodesThatAre(LinkTag.class); ! assertEquals("number of links",2,linkNodes.length); ! LinkTag linkTag = (LinkTag)linkNodes[0]; assertStringEquals("Link","http://www.yahoo.com/s/8741",linkTag.getLink()); // Verify the link data --- 414,421 ---- "<a href=s/7509><b>Yahoo! Movies</b></a>" + "</td>","http://www.yahoo.com"); ! NodeList linkNodes = parser.extractAllNodesThatMatch (new NodeClassFilter (LinkTag.class)); ! assertEquals("number of links", 2, linkNodes.size ()); ! LinkTag linkTag = (LinkTag)linkNodes.elementAt (0); assertStringEquals("Link","http://www.yahoo.com/s/8741",linkTag.getLink()); // Verify the link data Index: ObjectCollectionTest.java =================================================================== RCS file: //cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/ObjectCollectionTest.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ObjectCollectionTest.java 31 Jul 2004 16:42:31 -0000 1.22 --- ObjectCollectionTest.java 4 Jun 2006 19:17:20 -0000 1.23 *************** *** 30,33 **** --- 30,34 ---- import org.htmlparser.PrototypicalNodeFactory; import org.htmlparser.Tag; + import org.htmlparser.filters.NodeClassFilter; import org.htmlparser.tags.Div; import org.htmlparser.tags.Span; *************** *** 70,74 **** ); parser.setNodeFactory (new PrototypicalNodeFactory (new Span ())); ! assertSpanContent(parser.extractAllNodesThatAre(Span.class)); } --- 71,75 ---- ); parser.setNodeFactory (new PrototypicalNodeFactory (new Span ())); ! assertSpanContent(parser.extractAllNodesThatMatch (new NodeClassFilter (Span.class)).toNodeArray ()); } Index: BodyTagTest.java =================================================================== RCS file: //cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/BodyTagTest.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** BodyTagTest.java 20 Mar 2006 00:02:50 -0000 1.22 --- BodyTagTest.java 4 Jun 2006 19:17:20 -0000 1.23 *************** *** 78,82 **** NodeIterator iterator; Node node; - Hashtable attributes; try --- 78,81 ---- *************** *** 91,97 **** if (node instanceof BodyTag) { ! attributes = ((BodyTag)node).getAttributes (); ! assertTrue ("no style attribute", attributes.containsKey ("STYLE")); ! assertTrue ("no title attribute", attributes.containsKey ("TITLE")); } else --- 90,95 ---- if (node instanceof BodyTag) { ! assertNotNull ("no style attribute", ((BodyTag)node).getAttribute ("STYLE")); ! assertNotNull ("no title attribute", ((BodyTag)node).getAttribute ("TITLE")); } else |