[Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/utilTests AllTests.java,1.49,1.50 BeanTest.java
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-10-21 03:47:55
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests In directory sc8-pr-cvs1:/tmp/cvs-serv21682/utilTests Modified Files: AllTests.java BeanTest.java CharacterTranslationTest.java HTMLLinkProcessorTest.java HTMLParserUtilsTest.java NodeListTest.java SortTest.java Log Message: Consolidated the various testing main() methods into ParserTestCase. All unit test classes in the org.htmlparser.tests heirarchy should now be executable. Index: AllTests.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/AllTests.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** AllTests.java 18 Oct 2003 20:50:37 -0000 1.49 --- AllTests.java 21 Oct 2003 02:24:01 -0000 1.50 *************** *** 32,35 **** --- 32,37 ---- import junit.framework.TestSuite; + import org.htmlparser.tests.ParserTestCase; + /** * Insert the type's description here. *************** *** 37,111 **** * @author: Administrator */ ! public class AllTests extends junit.framework.TestCase { ! /** ! * AllTests constructor comment. ! * @param name java.lang.String ! */ ! public AllTests(String name) { ! super(name); ! } /** ! * Mainline for all suites of tests. ! * @param args Command line arguments. The following options ! * are understood: ! * <pre> ! * -text -- use junit.textui.TestRunner ! * -awt -- use junit.awtui.TestRunner ! * -swing -- use junit.swingui.TestRunner (default) ! * </pre> ! * All other options are passed on to the junit framework. */ ! public static void main(String[] args) ! { ! String runner; ! int i; ! String arguments[]; ! Class cls; ! ! runner = null; ! for (i = 0; (i < args.length) && (null == runner); i++) ! { ! if (args[i].equalsIgnoreCase ("-text")) ! runner = "junit.textui.TestRunner"; ! else if (args[i].equalsIgnoreCase ("-awt")) ! runner = "junit.awtui.TestRunner"; ! else if (args[i].equalsIgnoreCase ("-swing")) ! runner = "junit.swingui.TestRunner"; ! } ! if (null != runner) ! { ! // remove it from the arguments ! arguments = new String[args.length - 1]; ! System.arraycopy (args, 0, arguments, 0, i - 1); ! System.arraycopy (args, i, arguments, i - 1, args.length - i); ! args = arguments; ! } ! else ! runner = "junit.swingui.TestRunner"; ! ! // append the test class ! arguments = new String[args.length + 1]; ! System.arraycopy (args, 0, arguments, 0, args.length); ! arguments[args.length] = "org.htmlparser.tests.utilTests.AllTests"; ! ! // invoke main() of the test runner ! try ! { ! cls = Class.forName (runner); ! java.lang.reflect.Method method = cls.getDeclaredMethod ( ! "main", new Class[] { String[].class }); ! method.invoke ( ! null, ! new Object[] { arguments }); ! } ! catch (Throwable t) ! { ! System.err.println ( ! "cannot run unit test (" ! + t.getMessage () ! + ")"); ! } } --- 39,55 ---- * @author: Administrator */ ! public class AllTests extends ParserTestCase { ! static ! { ! System.setProperty ("org.htmlparser.tests.utilTests.AllTests", "AllTests"); ! } /** ! * AllTests constructor comment. ! * @param name java.lang.String */ ! public AllTests(String name) { ! super(name); } Index: BeanTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/BeanTest.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** BeanTest.java 29 Sep 2003 00:00:39 -0000 1.43 --- BeanTest.java 21 Oct 2003 02:24:01 -0000 1.44 *************** *** 54,57 **** --- 54,62 ---- public class BeanTest extends ParserTestCase { + static + { + System.setProperty ("org.htmlparser.tests.utilTests.BeanTest", "BeanTest"); + } + public BeanTest (String name) { Index: CharacterTranslationTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/CharacterTranslationTest.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** CharacterTranslationTest.java 22 Sep 2003 02:40:13 -0000 1.32 --- CharacterTranslationTest.java 21 Oct 2003 02:24:01 -0000 1.33 *************** *** 29,38 **** package org.htmlparser.tests.utilTests; ! import junit.framework.TestCase; ! import org.htmlparser.util.Translate; ! public class CharacterTranslationTest extends TestCase { public CharacterTranslationTest (String name) { --- 29,42 ---- package org.htmlparser.tests.utilTests; ! import org.htmlparser.tests.ParserTestCase; import org.htmlparser.util.Translate; ! public class CharacterTranslationTest extends ParserTestCase { + static + { + System.setProperty ("org.htmlparser.tests.utilTests.CharacterTranslationTest", "CharacterTranslationTest"); + } + public CharacterTranslationTest (String name) { Index: HTMLLinkProcessorTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/HTMLLinkProcessorTest.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** HTMLLinkProcessorTest.java 22 Sep 2003 02:40:13 -0000 1.46 --- HTMLLinkProcessorTest.java 21 Oct 2003 02:24:01 -0000 1.47 *************** *** 28,31 **** --- 28,32 ---- package org.htmlparser.tests.utilTests; + import org.htmlparser.tags.LinkTag; import org.htmlparser.tests.ParserTestCase; *************** *** 34,37 **** --- 35,43 ---- public class HTMLLinkProcessorTest extends ParserTestCase { + static + { + System.setProperty ("org.htmlparser.tests.utilTests.HTMLLinkProcessorTest", "HTMLLinkProcessorTest"); + } + private LinkProcessor lp; Index: HTMLParserUtilsTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/HTMLParserUtilsTest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** HTMLParserUtilsTest.java 22 Sep 2003 02:40:13 -0000 1.10 --- HTMLParserUtilsTest.java 21 Oct 2003 02:24:01 -0000 1.11 *************** *** 34,37 **** --- 34,42 ---- public class HTMLParserUtilsTest extends ParserTestCase { + static + { + System.setProperty ("org.htmlparser.tests.utilTests.HTMLParserUtilsTest", "HTMLParserUtilsTest"); + } + public HTMLParserUtilsTest(String name) { super(name); Index: NodeListTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/NodeListTest.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** NodeListTest.java 20 Oct 2003 01:28:04 -0000 1.19 --- NodeListTest.java 21 Oct 2003 02:24:01 -0000 1.20 *************** *** 36,39 **** --- 36,45 ---- public class NodeListTest extends ParserTestCase { + + static + { + System.setProperty ("org.htmlparser.tests.utilTests.NodeListTest", "NodeListTest"); + } + private NodeList nodeList; private Node[] testNodes; *************** *** 186,194 **** assertTrue("Second Element",null==nodeList.elementAt(1)); } - - public static void main(String[] args) - { - new junit.awtui.TestRunner().start(new String[] {NodeListTest.class.getName()}); - } - } --- 192,194 ---- Index: SortTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/SortTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SortTest.java 22 Sep 2003 02:40:14 -0000 1.6 --- SortTest.java 21 Oct 2003 02:24:01 -0000 1.7 *************** *** 35,40 **** import java.util.Vector; ! import junit.framework.TestCase; ! import org.htmlparser.util.sort.Ordered; import org.htmlparser.util.sort.Sort; --- 35,39 ---- import java.util.Vector; ! import org.htmlparser.tests.ParserTestCase; import org.htmlparser.util.sort.Ordered; import org.htmlparser.util.sort.Sort; *************** *** 44,49 **** * Sort testing. */ ! public class SortTest extends TestCase { /** --- 43,52 ---- * Sort testing. */ ! public class SortTest extends ParserTestCase { + static + { + System.setProperty ("org.htmlparser.tests.utilTests.SortTest", "SortTest"); + } /** |