1 27 package org.htmlparser.tests; 28 29 import org.htmlparser.Node; 30 import org.htmlparser.Parser; 31 import org.htmlparser.util.NodeIterator; 32 33 36 public class MemoryTest extends ParserTestCase 37 { 38 39 static 40 { 41 System.setProperty ("org.htmlparser.tests.MemoryTest", "MemoryTest"); 42 } 43 44 public MemoryTest (String name) 45 { 46 super (name); 47 } 48 49 52 public void testBigFile () throws Exception 53 { 54 Parser parser; 55 NodeIterator iterator; 56 Node node; 57 int size; 58 59 parser = new Parser ("http://htmlparser.sourceforge.net/test/A002.html"); 60 size = 0; 61 try 62 { 63 iterator = parser.elements (); 64 while (iterator.hasMoreNodes ()) 65 { 66 node = iterator.nextNode (); 67 size += node.toHtml ().length (); 68 } 69 } 70 catch (OutOfMemoryError ome) 71 { 72 fail ("out of memory"); 73 } 74 assertEquals ("wrong size fetched", 4697386, size); 75 } 76 77 } 78 | Popular Tags |