1 27 package org.htmlparser.tests.tagTests; 28 29 import org.htmlparser.tests.ParserTestCase; 30 import org.htmlparser.tags.Bullet; 31 import org.htmlparser.util.NodeIterator; 32 import org.htmlparser.util.ParserException; 33 34 public class BulletTagTest extends ParserTestCase 35 { 36 static 37 { 38 System.setProperty ("org.htmlparser.tests.tagTests.BulletTagTest", "BulletTagTest"); 39 } 40 41 public BulletTagTest (String name) 42 { 43 super(name); 44 } 45 46 public void testBulletFound() throws Exception { 47 createParser( 48 "<LI><A HREF=\"collapseHierarchy.html\">Collapse Hierarchy</A>\n"+ 49 "</LI>" 50 ); 51 parseAndAssertNodeCount(1); 52 assertType("should be a bullet",Bullet.class,node[0]); 53 } 54 55 56 public void testOutOfMemoryBug() throws ParserException { 57 createParser( 58 "<html>" + 59 "<head>" + 60 "<title>Foo</title>" + 61 "</head>" + 62 "<body>" + 63 " <ul>" + 64 " <li>" + 65 " <a HREF=\"http://foo.com/c.html\">bibliographies on:" + 66 " <ul>" + 67 " <li>chironomidae</li>" + 68 " </ul>" + 69 " </a>" + 70 " </li>" + 71 " </ul>" + 72 "" + 73 "</body>" + 74 "</html>" 75 ); 76 for (NodeIterator i = parser.elements();i.hasMoreNodes();) 77 i.nextNode(); 78 } 79 80 public void testNonEndedBullets() throws ParserException { 81 createParser( 82 "<li>forest practices legislation penalties for non-compliance\n"+ 83 " (Kwan) <A HREF=\"/hansard/37th3rd/h21107a.htm#4384\">4384-5</A>\n"+ 84 "<li>passenger rail service\n"+ 85 " (MacPhail) <A HREF=\"/hansard/37th3rd/h21021p.htm#3904\">3904</A>\n"+ 86 "<li>referendum on principles for treaty negotiations\n"+ 87 " (MacPhail) <A HREF=\"/hansard/37th3rd/h20313p.htm#1894\">1894</A>\n"+ 88 "<li>transportation infrastructure projects\n"+ 89 " (MacPhail) <A HREF=\"/hansard/37th3rd/h21022a.htm#3945\">3945-7</A>\n"+ 90 "<li>tuition fee freeze" 91 ); 92 parseAndAssertNodeCount(5); 93 for (int i=0;i<nodeCount;i++) { 94 assertType("node "+i,Bullet.class,node[i]); 95 } 96 } 97 } 98
| Popular Tags
|