[Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/utilTests AllTests.java,1.46,1.47 BeanTest.java
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-09-10 03:54:11
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests In directory sc8-pr-cvs1:/tmp/cvs-serv24483/src/org/htmlparser/tests/utilTests Modified Files: AllTests.java BeanTest.java CharacterTranslationTest.java HTMLLinkProcessorTest.java HTMLParserUtilsTest.java HTMLTagParserTest.java NodeListTest.java SortTest.java package.html Log Message: Add style checking target to ant build script: ant checkstyle It uses a jar from http://checkstyle.sourceforge.net which is dropped in the lib directory. The rules are in the file htmlparser_checks.xml in the src directory. Added lexerapplications package with Tabby as the first app. It performs whitespace manipulation on source files to follow the style rules. This reduced the number of style violations to roughly 14,000. There are a few issues with the style checker that need to be resolved before it should be taken too seriously. For example: It thinks all method arguments should be final, even if they are modified by the code (which the compiler frowns on). It complains about long lines, even when there is no possibility of wrapping the line, i.e. a URL in a comment that's more than 80 characters long. It considers all naked integers as 'magic numbers', even when they are obvious, i.e. the 4 corners of a box. It complains about whitespace following braces, even in array initializers, i.e. X[][] = { {a, b} { } } But it points out some really interesting things, even if you don't agree with the style guidelines, so it's worth a look. Index: AllTests.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/AllTests.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** AllTests.java 8 Sep 2003 02:26:31 -0000 1.46 --- AllTests.java 10 Sep 2003 03:38:25 -0000 1.47 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 37,41 **** * @author: Administrator */ ! public class AllTests extends junit.framework.TestCase { /** --- 37,41 ---- * @author: Administrator */ ! public class AllTests extends junit.framework.TestCase { /** *************** *** 128,131 **** return suite; ! } } --- 128,131 ---- return suite; ! } } Index: BeanTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/BeanTest.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** BeanTest.java 8 Sep 2003 02:26:32 -0000 1.40 --- BeanTest.java 10 Sep 2003 03:38:25 -0000 1.41 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 64,68 **** ObjectOutputStream oos; byte[] ret; ! bos = new ByteArrayOutputStream (); oos = new ObjectOutputStream (bos); --- 64,68 ---- ObjectOutputStream oos; byte[] ret; ! bos = new ByteArrayOutputStream (); oos = new ObjectOutputStream (bos); *************** *** 73,77 **** return (ret); } ! protected Object unpickle (byte[] data) throws --- 73,77 ---- return (ret); } ! protected Object unpickle (byte[] data) throws *************** *** 87,91 **** ret = ois.readObject (); ois.close (); ! return (ret); } --- 87,91 ---- ret = ois.readObject (); ois.close (); ! return (ret); } *************** *** 100,104 **** PrintWriter out; String string; ! path = System.getProperty ("user.dir"); if (!path.endsWith (File.separator)) --- 100,104 ---- PrintWriter out; String string; ! path = System.getProperty ("user.dir"); if (!path.endsWith (File.separator)) *************** *** 133,142 **** Parser parser; byte[] data; ! parser = new Parser (); data = pickle (parser); parser = (Parser)unpickle (data); } ! public void testSerializable () throws --- 133,142 ---- Parser parser; byte[] data; ! parser = new Parser (); data = pickle (parser); parser = (Parser)unpickle (data); } ! public void testSerializable () throws *************** *** 149,153 **** NodeIterator enumeration; byte[] data; ! parser = new Parser ("http://htmlparser.sourceforge.net/test/example.html"); enumeration = parser.elements (); --- 149,153 ---- NodeIterator enumeration; byte[] data; ! parser = new Parser ("http://htmlparser.sourceforge.net/test/example.html"); enumeration = parser.elements (); *************** *** 166,170 **** ((Node)enumeration.nextNode ()).toHtml ()); } ! public void testSerializableScanners () throws --- 166,170 ---- ((Node)enumeration.nextNode ()).toHtml ()); } ! public void testSerializableScanners () throws *************** *** 177,181 **** NodeIterator enumeration; byte[] data; ! parser = new Parser ("http://htmlparser.sourceforge.net/test/example.html"); parser.registerScanners (); --- 177,181 ---- NodeIterator enumeration; byte[] data; ! parser = new Parser ("http://htmlparser.sourceforge.net/test/example.html"); parser.registerScanners (); *************** *** 205,209 **** String text; byte[] data; ! sb = new StringBean (); sb.setURL ("http://htmlparser.sourceforge.net/test/example.html"); --- 205,209 ---- String text; byte[] data; ! sb = new StringBean (); sb.setURL ("http://htmlparser.sourceforge.net/test/example.html"); *************** *** 229,233 **** byte[] data; URL[] links2; ! lb = new LinkBean (); lb.setURL ("http://htmlparser.sourceforge.net/test/example.html"); --- 229,233 ---- byte[] data; URL[] links2; ! lb = new LinkBean (); lb.setURL ("http://htmlparser.sourceforge.net/test/example.html"); *************** *** 247,256 **** } } ! public void testStringBeanListener () { final StringBean sb; final Boolean hit[] = new Boolean[1]; ! sb = new StringBean (); hit[0] = Boolean.FALSE; --- 247,256 ---- } } ! public void testStringBeanListener () { final StringBean sb; final Boolean hit[] = new Boolean[1]; ! sb = new StringBean (); hit[0] = Boolean.FALSE; *************** *** 283,287 **** final LinkBean lb; final Boolean hit[] = new Boolean[1]; ! lb = new LinkBean (); hit[0] = Boolean.FALSE; --- 283,287 ---- final LinkBean lb; final Boolean hit[] = new Boolean[1]; ! lb = new LinkBean (); hit[0] = Boolean.FALSE; *************** *** 376,380 **** check (sb, "<html><head></head><body>\t\t x</body></html>", "x"); } ! /** * Test text including a "pre" tag --- 376,380 ---- check (sb, "<html><head></head><body>\t\t x</body></html>", "x"); } ! /** * Test text including a "pre" tag *************** *** 386,390 **** check (sb, "<body><pre>"+sampleCode+"</pre></body>", sampleCode); } ! /** * Test text including a "script" tag --- 386,390 ---- check (sb, "<body><pre>"+sampleCode+"</pre></body>", sampleCode); } ! /** * Test text including a "script" tag *************** *** 393,405 **** StringBean sb; sb = new StringBean (); ! String sampleScript = "<script language=\"javascript\">\r\n" ! + "if(navigator.appName.indexOf(\"Netscape\") != -1)\r\n" ! + " document.write ('xxx');\r\n" + "else\r\n" + " document.write ('yyy');\r\n" + "</script>\r\n"; ! check (sb, "<body>"+sampleScript+"</body>", ""); } --- 393,405 ---- StringBean sb; sb = new StringBean (); ! String sampleScript = "<script language=\"javascript\">\r\n" ! + "if(navigator.appName.indexOf(\"Netscape\") != -1)\r\n" ! + " document.write ('xxx');\r\n" + "else\r\n" + " document.write ('yyy');\r\n" + "</script>\r\n"; ! check (sb, "<body>"+sampleScript+"</body>", ""); } *************** *** 467,482 **** StringBean sb; sb = new StringBean (); ! String sampleScript = "<script language=\"javascript\">\r\n" ! + "if(navigator.appName.indexOf(\"Netscape\") != -1)\r\n" ! + " document.write ('xxx');\r\n" + "else\r\n" + " document.write ('yyy');\r\n" + "</script>\r\n"; ! check (sb, "<body><pre>"+sampleScript+"</pre></body>", sampleScript); } ! } --- 467,482 ---- StringBean sb; sb = new StringBean (); ! String sampleScript = "<script language=\"javascript\">\r\n" ! + "if(navigator.appName.indexOf(\"Netscape\") != -1)\r\n" ! + " document.write ('xxx');\r\n" + "else\r\n" + " document.write ('yyy');\r\n" + "</script>\r\n"; ! check (sb, "<body><pre>"+sampleScript+"</pre></body>", sampleScript); } ! } Index: CharacterTranslationTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/CharacterTranslationTest.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** CharacterTranslationTest.java 8 Sep 2003 02:26:32 -0000 1.30 --- CharacterTranslationTest.java 10 Sep 2003 03:38:25 -0000 1.31 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 39,43 **** super (name); } ! public void testInitialCharacterEntityReference () { --- 39,43 ---- super (name); } ! public void testInitialCharacterEntityReference () { Index: HTMLLinkProcessorTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/HTMLLinkProcessorTest.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** HTMLLinkProcessorTest.java 8 Sep 2003 02:26:32 -0000 1.44 --- HTMLLinkProcessorTest.java 10 Sep 2003 03:38:25 -0000 1.45 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 46,55 **** public void testIsURL() { String resourceLoc1 = "http://someurl.com"; ! String resourceLoc2 = "myfilehttp.dat"; assertTrue(resourceLoc1+" should be a url",LinkProcessor.isURL(resourceLoc1)); ! assertTrue(resourceLoc2+" should not be a url",!LinkProcessor.isURL(resourceLoc2)); String resourceLoc3 = "file://localhost/D:/java/jdk1.3/docs/api/overview-summary.html"; assertTrue(resourceLoc3+" should be a url",LinkProcessor.isURL(resourceLoc3)); ! } --- 46,55 ---- public void testIsURL() { String resourceLoc1 = "http://someurl.com"; ! String resourceLoc2 = "myfilehttp.dat"; assertTrue(resourceLoc1+" should be a url",LinkProcessor.isURL(resourceLoc1)); ! assertTrue(resourceLoc2+" should not be a url",!LinkProcessor.isURL(resourceLoc2)); String resourceLoc3 = "file://localhost/D:/java/jdk1.3/docs/api/overview-summary.html"; assertTrue(resourceLoc3+" should be a url",LinkProcessor.isURL(resourceLoc3)); ! } *************** *** 82,86 **** static final String baseURI = "http://a/b/c/d;p?q"; // the relative URI would be resolved as follows: ! // C.1. Normal Examples // g:h = g:h --- 82,86 ---- static final String baseURI = "http://a/b/c/d;p?q"; // the relative URI would be resolved as follows: ! // C.1. Normal Examples // g:h = g:h *************** *** 196,200 **** assertEquals ("test22 failed", "http://a/g", (new LinkProcessor ()).extract ("../../g", baseURI)); } ! // C.2. Abnormal Examples // Although the following abnormal examples are unlikely to occur in --- 196,200 ---- assertEquals ("test22 failed", "http://a/g", (new LinkProcessor ()).extract ("../../g", baseURI)); } ! // C.2. Abnormal Examples // Although the following abnormal examples are unlikely to occur in Index: HTMLParserUtilsTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/HTMLParserUtilsTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** HTMLParserUtilsTest.java 8 Sep 2003 02:26:32 -0000 1.8 --- HTMLParserUtilsTest.java 10 Sep 2003 03:38:25 -0000 1.9 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com Index: HTMLTagParserTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/HTMLTagParserTest.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** HTMLTagParserTest.java 8 Sep 2003 02:26:32 -0000 1.43 --- HTMLTagParserTest.java 10 Sep 2003 03:38:25 -0000 1.44 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 46,53 **** tagParser.correctTag(tag); assertStringEquals("Corrected Tag","font face=\"Arial,helvetica,\" sans-serif=\"sans-serif\" size=\"2\" color=\"#FFFFFF\"",tag.getText()); ! } public void testInsertInvertedCommasCorrectly() { ! StringBuffer test = new StringBuffer("a b=c d e = f"); StringBuffer result = tagParser.insertInvertedCommasCorrectly(test); assertStringEquals("Expected Correction","a b=\"c d\" e=\"f\"",result.toString()); --- 46,53 ---- tagParser.correctTag(tag); assertStringEquals("Corrected Tag","font face=\"Arial,helvetica,\" sans-serif=\"sans-serif\" size=\"2\" color=\"#FFFFFF\"",tag.getText()); ! } public void testInsertInvertedCommasCorrectly() { ! StringBuffer test = new StringBuffer("a b=c d e = f"); StringBuffer result = tagParser.insertInvertedCommasCorrectly(test); assertStringEquals("Expected Correction","a b=\"c d\" e=\"f\"",result.toString()); *************** *** 57,64 **** String test = " fdfdf dfdf "; assertEquals("Expected Pruned string","fdfdf dfdf",TagParser.pruneSpaces(test)); ! } protected void setUp() { ! tagParser = new TagParser(new DefaultParserFeedback()); ! } } --- 57,64 ---- String test = " fdfdf dfdf "; assertEquals("Expected Pruned string","fdfdf dfdf",TagParser.pruneSpaces(test)); ! } protected void setUp() { ! tagParser = new TagParser(new DefaultParserFeedback()); ! } } Index: NodeListTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/NodeListTest.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** NodeListTest.java 8 Sep 2003 02:26:32 -0000 1.16 --- NodeListTest.java 10 Sep 2003 03:38:25 -0000 1.17 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 38,42 **** private NodeList nodeList; private Node[] testNodes; ! public NodeListTest(String name) { super(name); --- 38,42 ---- private NodeList nodeList; private Node[] testNodes; ! public NodeListTest(String name) { super(name); *************** *** 44,50 **** protected void setUp() { ! nodeList = new NodeList(); } ! public void testAddOneItem() { Node node = createHTMLNodeObject(); --- 44,50 ---- protected void setUp() { ! nodeList = new NodeList(); } ! public void testAddOneItem() { Node node = createHTMLNodeObject(); *************** *** 63,77 **** assertTrue("Second Element",node2==nodeList.elementAt(1)); } ! public void testAddTenItems() { ! createTestDataAndPutInVector(10); assertTestDataCouldBeExtractedFromVector(10); } ! public void testAddElevenItems() { createTestDataAndPutInVector(11); assertTestDataCouldBeExtractedFromVector(11); } ! public void testAddThirtyItems() { createTestDataAndPutInVector(30); --- 63,77 ---- assertTrue("Second Element",node2==nodeList.elementAt(1)); } ! public void testAddTenItems() { ! createTestDataAndPutInVector(10); assertTestDataCouldBeExtractedFromVector(10); } ! public void testAddElevenItems() { createTestDataAndPutInVector(11); assertTestDataCouldBeExtractedFromVector(11); } ! public void testAddThirtyItems() { createTestDataAndPutInVector(30); *************** *** 79,83 **** assertEquals("Number of Adjustments",1,nodeList.getNumberOfAdjustments()); } ! public void testAddThirtyOneItems() { createTestDataAndPutInVector(31); --- 79,83 ---- assertEquals("Number of Adjustments",1,nodeList.getNumberOfAdjustments()); } ! public void testAddThirtyOneItems() { createTestDataAndPutInVector(31); *************** *** 85,89 **** assertEquals("Number of Adjustments",2,nodeList.getNumberOfAdjustments()); } ! public void testAddFiftyItems() { createTestDataAndPutInVector(50); --- 85,89 ---- assertEquals("Number of Adjustments",2,nodeList.getNumberOfAdjustments()); } ! public void testAddFiftyItems() { createTestDataAndPutInVector(50); *************** *** 91,95 **** assertEquals("Number of Adjustments",2,nodeList.getNumberOfAdjustments()); } ! public void testAddFiftyOneItems() { createTestDataAndPutInVector(51); --- 91,95 ---- assertEquals("Number of Adjustments",2,nodeList.getNumberOfAdjustments()); } ! public void testAddFiftyOneItems() { createTestDataAndPutInVector(51); *************** *** 97,106 **** assertEquals("Number of Adjustments",2,nodeList.getNumberOfAdjustments()); } ! public void testAddTwoHundredItems() { createTestDataAndPutInVector(200); assertEquals("Number of Adjustments",4,nodeList.getNumberOfAdjustments()); } ! public void testElements() throws Exception { createTestDataAndPutInVector(11); --- 97,106 ---- assertEquals("Number of Adjustments",2,nodeList.getNumberOfAdjustments()); } ! public void testAddTwoHundredItems() { createTestDataAndPutInVector(200); assertEquals("Number of Adjustments",4,nodeList.getNumberOfAdjustments()); } ! public void testElements() throws Exception { createTestDataAndPutInVector(11); *************** *** 112,118 **** i++; } ! } ! private Node createHTMLNodeObject() { Node node = new AbstractNode(10,20) { --- 112,118 ---- i++; } ! } ! private Node createHTMLNodeObject() { Node node = new AbstractNode(10,20) { *************** *** 122,134 **** public void collectInto(NodeList collectionList, String filter) { } ! public String toHtml() { return null; } ! public String toPlainTextString() { return null; } ! public String toString() { return ""; --- 122,134 ---- public void collectInto(NodeList collectionList, String filter) { } ! public String toHtml() { return null; } ! public String toPlainTextString() { return null; } ! public String toString() { return ""; *************** *** 139,143 **** private void createTestDataAndPutInVector(int nodeCount) { ! testNodes = new AbstractNode[nodeCount]; for (int i=0;i<nodeCount;i++) { testNodes[i]= createHTMLNodeObject(); --- 139,143 ---- private void createTestDataAndPutInVector(int nodeCount) { ! testNodes = new AbstractNode[nodeCount]; for (int i=0;i<nodeCount;i++) { testNodes[i]= createHTMLNodeObject(); *************** *** 151,155 **** } } ! public void testToNodeArray() { createTestDataAndPutInVector(387); --- 151,155 ---- } } ! public void testToNodeArray() { createTestDataAndPutInVector(387); *************** *** 159,163 **** assertNotNull("node "+i+" should not be null",nodes[i]); } ! public void testRemove() { Node node1 = createHTMLNodeObject(); --- 159,163 ---- assertNotNull("node "+i+" should not be null",nodes[i]); } ! public void testRemove() { Node node1 = createHTMLNodeObject(); *************** *** 172,176 **** assertTrue("First Element",node1==nodeList.elementAt(0)); } ! public void testRemoveAll() { Node node1 = createHTMLNodeObject(); --- 172,176 ---- assertTrue("First Element",node1==nodeList.elementAt(0)); } ! public void testRemoveAll() { Node node1 = createHTMLNodeObject(); *************** *** 186,191 **** assertTrue("Second Element",null==nodeList.elementAt(1)); } ! ! public static void main(String[] args) { new junit.awtui.TestRunner().start(new String[] {NodeListTest.class.getName()}); --- 186,191 ---- assertTrue("Second Element",null==nodeList.elementAt(1)); } ! ! public static void main(String[] args) { new junit.awtui.TestRunner().start(new String[] {NodeListTest.class.getName()}); Index: SortTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/SortTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SortTest.java 8 Sep 2003 02:26:32 -0000 1.4 --- SortTest.java 10 Sep 2003 03:38:25 -0000 1.5 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 46,50 **** public class SortTest extends TestCase { ! /** * Creates a new instance of SortTest --- 46,50 ---- public class SortTest extends TestCase { ! /** * Creates a new instance of SortTest *************** *** 71,75 **** return (mData.compareTo (((Item)o).mData)); } ! public String toString () { --- 71,75 ---- return (mData.compareTo (((Item)o).mData)); } ! public String toString () { *************** *** 86,90 **** { StringTokenizer toks; ! toks = new StringTokenizer (words); outer: --- 86,90 ---- { StringTokenizer toks; ! toks = new StringTokenizer (words); outer: *************** *** 97,101 **** // Sortable interface // ! public int first () { --- 97,101 ---- // Sortable interface // ! public int first () { *************** *** 146,155 **** return ((int)ret); ! } } /** * Test the operation of the static quicksort algorithm. ! */ public void testQuickSort () { --- 146,155 ---- return ((int)ret); ! } } /** * Test the operation of the static quicksort algorithm. ! */ public void testQuickSort () { *************** *** 167,171 **** Sort.QuickSort (words); ! assertEquals ("element 0 wrong ", "Derrick", words[0].mData); assertEquals ("element 1 wrong ", "breast", words[1].mData); --- 167,171 ---- Sort.QuickSort (words); ! assertEquals ("element 0 wrong ", "Derrick", words[0].mData); assertEquals ("element 1 wrong ", "breast", words[1].mData); *************** *** 180,184 **** /** * Test the operation of quicksort on a sortable list. ! */ public void testSortList () { --- 180,184 ---- /** * Test the operation of quicksort on a sortable list. ! */ public void testSortList () { *************** *** 200,209 **** + "raths slithy the the the the toves wabe were", b.toString ()); ! } ! /** * Test the operation of quicksort on a vector of ordered items. ! */ public void testSortVector () { --- 200,209 ---- + "raths slithy the the the the toves wabe were", b.toString ()); ! } ! /** * Test the operation of quicksort on a vector of ordered items. ! */ public void testSortVector () { *************** *** 217,221 **** if (f.isFile ()) directory.addElement (f); ! } Sort.QuickSort (directory); --- 217,221 ---- if (f.isFile ()) directory.addElement (f); ! } Sort.QuickSort (directory); Index: package.html =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/package.html,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** package.html 8 Sep 2003 02:26:32 -0000 1.13 --- package.html 10 Sep 2003 03:38:25 -0000 1.14 *************** *** 18,22 **** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. ! You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software --- 18,22 ---- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. ! You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software *************** *** 25,41 **** For any questions or suggestions, you can write to me at : Email :so...@in... ! ! Postal Address : Somik Raha Extreme Programmer & Coach Industrial Logic Corporation ! 2583 Cedar Street, Berkeley, CA 94708, USA Website : http://www.industriallogic.com ! --> </head> <body bgcolor="white"> ! This package contains testcases for the util package. <h2>Related Documentation</h2> --- 25,41 ---- For any questions or suggestions, you can write to me at : Email :so...@in... ! ! Postal Address : Somik Raha Extreme Programmer & Coach Industrial Logic Corporation ! 2583 Cedar Street, Berkeley, CA 94708, USA Website : http://www.industriallogic.com ! --> </head> <body bgcolor="white"> ! This package contains testcases for the util package. <h2>Related Documentation</h2> |