|
Lines 136-146
Link Here
|
| 136 |
buf= new StringBuffer(); |
136 |
buf= new StringBuffer(); |
| 137 |
buf.append("package junit.runner;\n"); |
137 |
buf.append("package junit.runner;\n"); |
| 138 |
buf.append("\n"); |
138 |
buf.append("\n"); |
| 139 |
buf.append("import junit.framework.*;\n"); |
139 |
buf.append("import java.io.BufferedReader;\n"); |
| 140 |
buf.append("import java.lang.reflect.*;\n"); |
140 |
buf.append("import java.io.File;\n"); |
|
|
141 |
buf.append("import java.io.FileInputStream;\n"); |
| 142 |
buf.append("import java.io.FileOutputStream;\n"); |
| 143 |
buf.append("import java.io.IOException;\n"); |
| 144 |
buf.append("import java.io.InputStream;\n"); |
| 145 |
buf.append("import java.io.PrintWriter;\n"); |
| 146 |
buf.append("import java.io.StringReader;\n"); |
| 147 |
buf.append("import java.io.StringWriter;\n"); |
| 148 |
buf.append("import java.lang.reflect.InvocationTargetException;\n"); |
| 149 |
buf.append("import java.lang.reflect.Method;\n"); |
| 150 |
buf.append("import java.lang.reflect.Modifier;\n"); |
| 141 |
buf.append("import java.text.NumberFormat;\n"); |
151 |
buf.append("import java.text.NumberFormat;\n"); |
| 142 |
buf.append("import java.io.*;\n"); |
152 |
buf.append("import java.util.Properties;\n"); |
| 143 |
buf.append("import java.util.*;\n"); |
153 |
buf.append("\n"); |
|
|
154 |
buf.append("import junit.framework.AssertionFailedError;\n"); |
| 155 |
buf.append("import junit.framework.Test;\n"); |
| 156 |
buf.append("import junit.framework.TestListener;\n"); |
| 157 |
buf.append("import junit.framework.TestSuite;\n"); |
| 144 |
buf.append("\n"); |
158 |
buf.append("\n"); |
| 145 |
buf.append("/**\n"); |
159 |
buf.append("/**\n"); |
| 146 |
buf.append(" * Base class for all test runners. This class was born live on stage in\n"); |
160 |
buf.append(" * Base class for all test runners. This class was born live on stage in\n"); |
|
Lines 248-254
Link Here
|
| 248 |
buf.append(" }\n"); |
262 |
buf.append(" }\n"); |
| 249 |
buf.append(" Test test = null;\n"); |
263 |
buf.append(" Test test = null;\n"); |
| 250 |
buf.append(" try {\n"); |
264 |
buf.append(" try {\n"); |
| 251 |
buf.append(" test = (Test) suiteMethod.invoke(null, new Class[0]); // static method\n"); |
265 |
buf.append(" test = (Test) suiteMethod.invoke(null, new Class[0]); // static\n"); |
|
|
266 |
buf.append(" // method\n"); |
| 252 |
buf.append(" if (test == null) {\n"); |
267 |
buf.append(" if (test == null) {\n"); |
| 253 |
buf.append(" return test;\n"); |
268 |
buf.append(" return test;\n"); |
| 254 |
buf.append(" }\n"); |
269 |
buf.append(" }\n"); |
|
Lines 451-457
Link Here
|
| 451 |
buf.append(" final String[] patterns = new String[]{\"junit.framework.TestCase\", //$NON-NLS-1$\n"); |
466 |
buf.append(" final String[] patterns = new String[]{\"junit.framework.TestCase\", //$NON-NLS-1$\n"); |
| 452 |
buf.append(" \"junit.framework.TestResult\", //$NON-NLS-1$\n"); |
467 |
buf.append(" \"junit.framework.TestResult\", //$NON-NLS-1$\n"); |
| 453 |
buf.append(" \"junit.framework.TestSuite\", //$NON-NLS-1$\n"); |
468 |
buf.append(" \"junit.framework.TestSuite\", //$NON-NLS-1$\n"); |
| 454 |
buf.append(" \"junit.framework.Assert.\", // don't filter AssertionFailure //$NON-NLS-1$\n"); |
469 |
buf.append(" \"junit.framework.Assert.\", // don't filter AssertionFailure\n"); |
|
|
470 |
buf.append(" // //$NON-NLS-1$\n"); |
| 455 |
buf.append(" \"junit.swingui.TestRunner\", //$NON-NLS-1$\n"); |
471 |
buf.append(" \"junit.swingui.TestRunner\", //$NON-NLS-1$\n"); |
| 456 |
buf.append(" \"junit.awtui.TestRunner\", //$NON-NLS-1$\n"); |
472 |
buf.append(" \"junit.awtui.TestRunner\", //$NON-NLS-1$\n"); |
| 457 |
buf.append(" \"junit.textui.TestRunner\", //$NON-NLS-1$\n"); |
473 |
buf.append(" \"junit.textui.TestRunner\", //$NON-NLS-1$\n"); |
|
Lines 491-498
Link Here
|
| 491 |
buf= new StringBuffer(); |
507 |
buf= new StringBuffer(); |
| 492 |
buf.append("package junit.tests.runner;\n"); |
508 |
buf.append("package junit.tests.runner;\n"); |
| 493 |
buf.append("\n"); |
509 |
buf.append("\n"); |
| 494 |
buf.append("import java.io.*;\n"); |
510 |
buf.append("import java.io.PrintWriter;\n"); |
| 495 |
buf.append("import junit.framework.*;\n"); |
511 |
buf.append("import java.io.StringWriter;\n"); |
|
|
512 |
buf.append("\n"); |
| 513 |
buf.append("import junit.framework.Assert;\n"); |
| 514 |
buf.append("import junit.framework.TestCase;\n"); |
| 496 |
buf.append("import junit.runner.BaseTestRunner;\n"); |
515 |
buf.append("import junit.runner.BaseTestRunner;\n"); |
| 497 |
buf.append("\n"); |
516 |
buf.append("\n"); |
| 498 |
buf.append("public class StackFilterTest extends TestCase {\n"); |
517 |
buf.append("public class StackFilterTest extends TestCase {\n"); |
|
Lines 760-766
Link Here
|
| 760 |
buf= new StringBuffer(); |
779 |
buf= new StringBuffer(); |
| 761 |
buf.append("package junit.samples;\n"); |
780 |
buf.append("package junit.samples;\n"); |
| 762 |
buf.append("\n"); |
781 |
buf.append("\n"); |
| 763 |
buf.append("import junit.framework.*;\n"); |
782 |
buf.append("import junit.framework.Test;\n"); |
|
|
783 |
buf.append("import junit.framework.TestSuite;\n"); |
| 764 |
buf.append("\n"); |
784 |
buf.append("\n"); |
| 765 |
buf.append("/**\n"); |
785 |
buf.append("/**\n"); |
| 766 |
buf.append(" * TestSuite that runs all the sample tests\n"); |
786 |
buf.append(" * TestSuite that runs all the sample tests\n"); |
|
Lines 783-790
Link Here
|
| 783 |
buf= new StringBuffer(); |
803 |
buf= new StringBuffer(); |
| 784 |
buf.append("package junit.tests.extensions;\n"); |
804 |
buf.append("package junit.tests.extensions;\n"); |
| 785 |
buf.append("\n"); |
805 |
buf.append("\n"); |
| 786 |
buf.append("import junit.framework.*;\n"); |
806 |
buf.append("import junit.extensions.ExceptionTestCase;\n"); |
| 787 |
buf.append("import junit.extensions.*;\n"); |
807 |
buf.append("import junit.framework.Assert;\n"); |
|
|
808 |
buf.append("import junit.framework.TestResult;\n"); |
| 788 |
buf.append("\n"); |
809 |
buf.append("\n"); |
| 789 |
buf.append("public class ExceptionTestCaseTest extends junit.framework.TestCase {\n"); |
810 |
buf.append("public class ExceptionTestCaseTest extends junit.framework.TestCase {\n"); |
| 790 |
buf.append("\n"); |
811 |
buf.append("\n"); |
|
Lines 858-864
Link Here
|
| 858 |
buf.append("/**\n"); |
879 |
buf.append("/**\n"); |
| 859 |
buf.append(" * Test class used in SuiteTest\n"); |
880 |
buf.append(" * Test class used in SuiteTest\n"); |
| 860 |
buf.append(" */\n"); |
881 |
buf.append(" */\n"); |
| 861 |
buf.append("import junit.framework.*;\n"); |
882 |
buf.append("import junit.framework.Assert;\n"); |
|
|
883 |
buf.append("import junit.framework.AssertionFailedError;\n"); |
| 884 |
buf.append("import junit.framework.Test;\n"); |
| 885 |
buf.append("import junit.framework.TestCase;\n"); |
| 886 |
buf.append("import junit.framework.TestListener;\n"); |
| 887 |
buf.append("import junit.framework.TestResult;\n"); |
| 862 |
buf.append("\n"); |
888 |
buf.append("\n"); |
| 863 |
buf.append("public class TestListenerTest extends TestCase implements TestListener {\n"); |
889 |
buf.append("public class TestListenerTest extends TestCase implements TestListener {\n"); |
| 864 |
buf.append(" private TestResult fResult;\n"); |
890 |
buf.append(" private TestResult fResult;\n"); |
|
Lines 927-933
Link Here
|
| 927 |
buf.append("\n"); |
953 |
buf.append("\n"); |
| 928 |
buf.append("import java.util.Vector;\n"); |
954 |
buf.append("import java.util.Vector;\n"); |
| 929 |
buf.append("\n"); |
955 |
buf.append("\n"); |
| 930 |
buf.append("import junit.framework.*;\n"); |
956 |
buf.append("import junit.framework.Assert;\n"); |
|
|
957 |
buf.append("import junit.framework.TestCase;\n"); |
| 931 |
buf.append("import junit.runner.Sorter;\n"); |
958 |
buf.append("import junit.runner.Sorter;\n"); |
| 932 |
buf.append("\n"); |
959 |
buf.append("\n"); |
| 933 |
buf.append("public class SorterTest extends TestCase {\n"); |
960 |
buf.append("public class SorterTest extends TestCase {\n"); |
|
Lines 972-978
Link Here
|
| 972 |
buf= new StringBuffer(); |
999 |
buf= new StringBuffer(); |
| 973 |
buf.append("package junit.tests.framework;\n"); |
1000 |
buf.append("package junit.tests.framework;\n"); |
| 974 |
buf.append("\n"); |
1001 |
buf.append("\n"); |
| 975 |
buf.append("import junit.framework.*;\n"); |
1002 |
buf.append("import junit.framework.Assert;\n"); |
|
|
1003 |
buf.append("import junit.framework.Protectable;\n"); |
| 1004 |
buf.append("import junit.framework.Test;\n"); |
| 1005 |
buf.append("import junit.framework.TestCase;\n"); |
| 1006 |
buf.append("import junit.framework.TestResult;\n"); |
| 976 |
buf.append("\n"); |
1007 |
buf.append("\n"); |
| 977 |
buf.append("/**\n"); |
1008 |
buf.append("/**\n"); |
| 978 |
buf.append(" * Test an implementor of junit.framework.Test other than TestCase or TestSuite\n"); |
1009 |
buf.append(" * Test an implementor of junit.framework.Test other than TestCase or TestSuite\n"); |
|
Lines 1026-1032
Link Here
|
| 1026 |
buf= new StringBuffer(); |
1057 |
buf= new StringBuffer(); |
| 1027 |
buf.append("package junit.extensions;\n"); |
1058 |
buf.append("package junit.extensions;\n"); |
| 1028 |
buf.append("\n"); |
1059 |
buf.append("\n"); |
| 1029 |
buf.append("import junit.framework.*;\n"); |
1060 |
buf.append("import junit.framework.Assert;\n"); |
|
|
1061 |
buf.append("import junit.framework.Test;\n"); |
| 1062 |
buf.append("import junit.framework.TestResult;\n"); |
| 1030 |
buf.append("\n"); |
1063 |
buf.append("\n"); |
| 1031 |
buf.append("/**\n"); |
1064 |
buf.append("/**\n"); |
| 1032 |
buf.append(" * A Decorator for Tests. Use TestDecorator as the base class for defining new\n"); |
1065 |
buf.append(" * A Decorator for Tests. Use TestDecorator as the base class for defining new\n"); |
|
Lines 1263-1269
Link Here
|
| 1263 |
buf= new StringBuffer(); |
1296 |
buf= new StringBuffer(); |
| 1264 |
buf.append("package junit.extensions;\n"); |
1297 |
buf.append("package junit.extensions;\n"); |
| 1265 |
buf.append("\n"); |
1298 |
buf.append("\n"); |
| 1266 |
buf.append("import junit.framework.*;\n"); |
1299 |
buf.append("import junit.framework.Test;\n"); |
|
|
1300 |
buf.append("import junit.framework.TestResult;\n"); |
| 1301 |
buf.append("import junit.framework.TestSuite;\n"); |
| 1267 |
buf.append("\n"); |
1302 |
buf.append("\n"); |
| 1268 |
buf.append("/**\n"); |
1303 |
buf.append("/**\n"); |
| 1269 |
buf.append(" * A TestSuite for active Tests. It runs each test in a separate thread and\n"); |
1304 |
buf.append(" * A TestSuite for active Tests. It runs each test in a separate thread and\n"); |
|
Lines 1331-1337
Link Here
|
| 1331 |
buf= new StringBuffer(); |
1366 |
buf= new StringBuffer(); |
| 1332 |
buf.append("package junit.tests.framework;\n"); |
1367 |
buf.append("package junit.tests.framework;\n"); |
| 1333 |
buf.append("\n"); |
1368 |
buf.append("\n"); |
| 1334 |
buf.append("import junit.framework.*;\n"); |
1369 |
buf.append("import junit.framework.Assert;\n"); |
|
|
1370 |
buf.append("import junit.framework.Test;\n"); |
| 1371 |
buf.append("import junit.framework.TestCase;\n"); |
| 1372 |
buf.append("import junit.framework.TestResult;\n"); |
| 1373 |
buf.append("import junit.framework.TestSuite;\n"); |
| 1335 |
buf.append("\n"); |
1374 |
buf.append("\n"); |
| 1336 |
buf.append("/**\n"); |
1375 |
buf.append("/**\n"); |
| 1337 |
buf.append(" * A fixture for testing the \"auto\" test suite feature.\n"); |
1376 |
buf.append(" * A fixture for testing the \"auto\" test suite feature.\n"); |
|
Lines 1475-1481
Link Here
|
| 1475 |
buf= new StringBuffer(); |
1514 |
buf= new StringBuffer(); |
| 1476 |
buf.append("package junit.tests.framework;\n"); |
1515 |
buf.append("package junit.tests.framework;\n"); |
| 1477 |
buf.append("\n"); |
1516 |
buf.append("\n"); |
| 1478 |
buf.append("import junit.framework.*;\n"); |
1517 |
buf.append("import junit.framework.TestCase;\n"); |
| 1479 |
buf.append("\n"); |
1518 |
buf.append("\n"); |
| 1480 |
buf.append("/**\n"); |
1519 |
buf.append("/**\n"); |
| 1481 |
buf.append(" * A test case testing the testing framework.\n"); |
1520 |
buf.append(" * A test case testing the testing framework.\n"); |
|
Lines 1494-1501
Link Here
|
| 1494 |
buf= new StringBuffer(); |
1533 |
buf= new StringBuffer(); |
| 1495 |
buf.append("package junit.runner;\n"); |
1534 |
buf.append("package junit.runner;\n"); |
| 1496 |
buf.append("\n"); |
1535 |
buf.append("\n"); |
| 1497 |
buf.append("import java.lang.reflect.*;\n"); |
1536 |
buf.append("import java.lang.reflect.Modifier;\n"); |
| 1498 |
buf.append("import junit.framework.*;\n"); |
1537 |
buf.append("\n"); |
|
|
1538 |
buf.append("import junit.framework.Test;\n"); |
| 1539 |
buf.append("import junit.framework.TestSuite;\n"); |
| 1499 |
buf.append("\n"); |
1540 |
buf.append("\n"); |
| 1500 |
buf.append("/**\n"); |
1541 |
buf.append("/**\n"); |
| 1501 |
buf.append(" * An implementation of a TestCollector that loads all classes on the class path\n"); |
1542 |
buf.append(" * An implementation of a TestCollector that loads all classes on the class path\n"); |
|
Lines 1569-1578
Link Here
|
| 1569 |
buf= new StringBuffer(); |
1610 |
buf= new StringBuffer(); |
| 1570 |
buf.append("package junit.runner;\n"); |
1611 |
buf.append("package junit.runner;\n"); |
| 1571 |
buf.append("\n"); |
1612 |
buf.append("\n"); |
| 1572 |
buf.append("import java.util.*;\n"); |
1613 |
buf.append("import java.io.ByteArrayOutputStream;\n"); |
| 1573 |
buf.append("import java.io.*;\n"); |
1614 |
buf.append("import java.io.File;\n"); |
|
|
1615 |
buf.append("import java.io.FileInputStream;\n"); |
| 1616 |
buf.append("import java.io.IOException;\n"); |
| 1617 |
buf.append("import java.io.InputStream;\n"); |
| 1574 |
buf.append("import java.net.URL;\n"); |
1618 |
buf.append("import java.net.URL;\n"); |
| 1575 |
buf.append("import java.util.zip.*;\n"); |
1619 |
buf.append("import java.util.Enumeration;\n"); |
|
|
1620 |
buf.append("import java.util.Properties;\n"); |
| 1621 |
buf.append("import java.util.StringTokenizer;\n"); |
| 1622 |
buf.append("import java.util.Vector;\n"); |
| 1623 |
buf.append("import java.util.zip.ZipEntry;\n"); |
| 1624 |
buf.append("import java.util.zip.ZipFile;\n"); |
| 1576 |
buf.append("\n"); |
1625 |
buf.append("\n"); |
| 1577 |
buf.append("/**\n"); |
1626 |
buf.append("/**\n"); |
| 1578 |
buf.append(" * A custom class loader which enables the reloading of classes for each test\n"); |
1627 |
buf.append(" * A custom class loader which enables the reloading of classes for each test\n"); |
|
Lines 1835-1841
Link Here
|
| 1835 |
buf= new StringBuffer(); |
1884 |
buf= new StringBuffer(); |
| 1836 |
buf.append("package junit.samples;\n"); |
1885 |
buf.append("package junit.samples;\n"); |
| 1837 |
buf.append("\n"); |
1886 |
buf.append("\n"); |
| 1838 |
buf.append("import junit.framework.*;\n"); |
1887 |
buf.append("import junit.framework.Assert;\n"); |
|
|
1888 |
buf.append("import junit.framework.Test;\n"); |
| 1889 |
buf.append("import junit.framework.TestCase;\n"); |
| 1890 |
buf.append("import junit.framework.TestSuite;\n"); |
| 1839 |
buf.append("\n"); |
1891 |
buf.append("\n"); |
| 1840 |
buf.append("/**\n"); |
1892 |
buf.append("/**\n"); |
| 1841 |
buf.append(" * Some simple tests.\n"); |
1893 |
buf.append(" * Some simple tests.\n"); |
|
Lines 1942-1950
Link Here
|
| 1942 |
buf.append(" public void testInvokeNonStaticSuite() {\n"); |
1994 |
buf.append(" public void testInvokeNonStaticSuite() {\n"); |
| 1943 |
buf.append(" final BaseTestRunner runner = new MockRunner();\n"); |
1995 |
buf.append(" final BaseTestRunner runner = new MockRunner();\n"); |
| 1944 |
buf.append(" runner.getTest(\"junit.tests.runner.BaseTestRunnerTest$NonStatic\"); // Used\n"); |
1996 |
buf.append(" runner.getTest(\"junit.tests.runner.BaseTestRunnerTest$NonStatic\"); // Used\n"); |
| 1945 |
buf.append(" // to\n"); |
1997 |
buf.append(" // to\n"); |
| 1946 |
buf.append(" // throw\n"); |
1998 |
buf.append(" // throw\n"); |
| 1947 |
buf.append(" // NullPointerException //$NON-NLS-1$\n"); |
1999 |
buf.append(" // NullPointerException\n"); |
|
|
2000 |
buf.append(" // //$NON-NLS-1$\n"); |
| 1948 |
buf.append(" }\n"); |
2001 |
buf.append(" }\n"); |
| 1949 |
buf.append("}\n"); |
2002 |
buf.append("}\n"); |
| 1950 |
buf.append(""); |
2003 |
buf.append(""); |
|
Lines 1952-1958
Link Here
|
| 1952 |
buf= new StringBuffer(); |
2005 |
buf= new StringBuffer(); |
| 1953 |
buf.append("package junit.tests;\n"); |
2006 |
buf.append("package junit.tests;\n"); |
| 1954 |
buf.append("\n"); |
2007 |
buf.append("\n"); |
| 1955 |
buf.append("import junit.framework.*;\n"); |
2008 |
buf.append("import junit.framework.TestCase;\n"); |
| 1956 |
buf.append("\n"); |
2009 |
buf.append("\n"); |
| 1957 |
buf.append("/**\n"); |
2010 |
buf.append("/**\n"); |
| 1958 |
buf.append(" * A helper test case for testing whether the testing method is run.\n"); |
2011 |
buf.append(" * A helper test case for testing whether the testing method is run.\n"); |
|
Lines 1968-1978
Link Here
|
| 1968 |
buf= new StringBuffer(); |
2021 |
buf= new StringBuffer(); |
| 1969 |
buf.append("package junit.framework;\n"); |
2022 |
buf.append("package junit.framework;\n"); |
| 1970 |
buf.append("\n"); |
2023 |
buf.append("\n"); |
| 1971 |
buf.append("import java.util.Vector;\n"); |
|
|
| 1972 |
buf.append("import java.util.Enumeration;\n"); |
| 1973 |
buf.append("import java.io.PrintWriter;\n"); |
2024 |
buf.append("import java.io.PrintWriter;\n"); |
| 1974 |
buf.append("import java.io.StringWriter;\n"); |
2025 |
buf.append("import java.io.StringWriter;\n"); |
| 1975 |
buf.append("import java.lang.reflect.*;\n"); |
2026 |
buf.append("import java.lang.reflect.Constructor;\n"); |
|
|
2027 |
buf.append("import java.lang.reflect.InvocationTargetException;\n"); |
| 2028 |
buf.append("import java.lang.reflect.Method;\n"); |
| 2029 |
buf.append("import java.lang.reflect.Modifier;\n"); |
| 2030 |
buf.append("import java.util.Enumeration;\n"); |
| 2031 |
buf.append("import java.util.Vector;\n"); |
| 1976 |
buf.append("\n"); |
2032 |
buf.append("\n"); |
| 1977 |
buf.append("/**\n"); |
2033 |
buf.append("/**\n"); |
| 1978 |
buf.append(" * A <code>TestSuite</code> is a <code>Composite</code> of Tests. It runs a\n"); |
2034 |
buf.append(" * A <code>TestSuite</code> is a <code>Composite</code> of Tests. It runs a\n"); |
|
Lines 2026-2033
Link Here
|
| 2026 |
buf.append(" public TestSuite(final Class theClass) {\n"); |
2082 |
buf.append(" public TestSuite(final Class theClass) {\n"); |
| 2027 |
buf.append(" this.fName = theClass.getName();\n"); |
2083 |
buf.append(" this.fName = theClass.getName();\n"); |
| 2028 |
buf.append(" try {\n"); |
2084 |
buf.append(" try {\n"); |
| 2029 |
buf.append(" TestSuite.getTestConstructor(theClass); // Avoid generating multiple error\n"); |
2085 |
buf.append(" TestSuite.getTestConstructor(theClass); // Avoid generating multiple\n"); |
| 2030 |
buf.append(" // messages\n"); |
2086 |
buf.append(" // error messages\n"); |
| 2031 |
buf.append(" } catch (final NoSuchMethodException e) {\n"); |
2087 |
buf.append(" } catch (final NoSuchMethodException e) {\n"); |
| 2032 |
buf.append(" this\n"); |
2088 |
buf.append(" this\n"); |
| 2033 |
buf.append(" .addTest(TestSuite\n"); |
2089 |
buf.append(" .addTest(TestSuite\n"); |
|
Lines 2261-2267
Link Here
|
| 2261 |
buf= new StringBuffer(); |
2317 |
buf= new StringBuffer(); |
| 2262 |
buf.append("package junit.extensions;\n"); |
2318 |
buf.append("package junit.extensions;\n"); |
| 2263 |
buf.append("\n"); |
2319 |
buf.append("\n"); |
| 2264 |
buf.append("import junit.framework.*;\n"); |
2320 |
buf.append("import junit.framework.Assert;\n"); |
|
|
2321 |
buf.append("import junit.framework.TestCase;\n"); |
| 2265 |
buf.append("\n"); |
2322 |
buf.append("\n"); |
| 2266 |
buf.append("/**\n"); |
2323 |
buf.append("/**\n"); |
| 2267 |
buf.append(" * A TestCase that expects an Exception of class fExpected to be thrown. The\n"); |
2324 |
buf.append(" * A TestCase that expects an Exception of class fExpected to be thrown. The\n"); |
|
Lines 2420-2428
Link Here
|
| 2420 |
buf.append(" actual));\n"); |
2477 |
buf.append(" actual));\n"); |
| 2421 |
buf.append(" }\n"); |
2478 |
buf.append(" }\n"); |
| 2422 |
buf.append(" } else if (!(Math.abs(expected - actual) <= delta)) {\n"); |
2479 |
buf.append(" } else if (!(Math.abs(expected - actual) <= delta)) {\n"); |
| 2423 |
buf.append(" // comparison with\n"); |
|
|
| 2424 |
buf.append(" // NaN always\n"); |
| 2425 |
buf.append(" // returns false\n"); |
| 2426 |
buf.append(" Assert.failNotEquals(message, new Double(expected), new Double(\n"); |
2480 |
buf.append(" Assert.failNotEquals(message, new Double(expected), new Double(\n"); |
| 2427 |
buf.append(" actual));\n"); |
2481 |
buf.append(" actual));\n"); |
| 2428 |
buf.append(" }\n"); |
2482 |
buf.append(" }\n"); |
|
Lines 2651-2658
Link Here
|
| 2651 |
buf= new StringBuffer(); |
2705 |
buf= new StringBuffer(); |
| 2652 |
buf.append("package junit.runner;\n"); |
2706 |
buf.append("package junit.runner;\n"); |
| 2653 |
buf.append("\n"); |
2707 |
buf.append("\n"); |
| 2654 |
buf.append("import java.util.*;\n"); |
2708 |
buf.append("import java.io.File;\n"); |
| 2655 |
buf.append("import java.io.*;\n"); |
2709 |
buf.append("import java.util.Enumeration;\n"); |
|
|
2710 |
buf.append("import java.util.Hashtable;\n"); |
| 2711 |
buf.append("import java.util.StringTokenizer;\n"); |
| 2712 |
buf.append("import java.util.Vector;\n"); |
| 2656 |
buf.append("\n"); |
2713 |
buf.append("\n"); |
| 2657 |
buf.append("/**\n"); |
2714 |
buf.append("/**\n"); |
| 2658 |
buf.append(" * An implementation of a TestCollector that consults the class path. It\n"); |
2715 |
buf.append(" * An implementation of a TestCollector that consults the class path. It\n"); |
|
Lines 2766-2773
Link Here
|
| 2766 |
buf= new StringBuffer(); |
2823 |
buf= new StringBuffer(); |
| 2767 |
buf.append("package junit.tests.extensions;\n"); |
2824 |
buf.append("package junit.tests.extensions;\n"); |
| 2768 |
buf.append("\n"); |
2825 |
buf.append("\n"); |
| 2769 |
buf.append("import junit.framework.*;\n"); |
2826 |
buf.append("import junit.extensions.ActiveTestSuite;\n"); |
| 2770 |
buf.append("import junit.extensions.*;\n"); |
2827 |
buf.append("import junit.extensions.RepeatedTest;\n"); |
|
|
2828 |
buf.append("import junit.framework.Assert;\n"); |
| 2829 |
buf.append("import junit.framework.Test;\n"); |
| 2830 |
buf.append("import junit.framework.TestCase;\n"); |
| 2831 |
buf.append("import junit.framework.TestResult;\n"); |
| 2771 |
buf.append("\n"); |
2832 |
buf.append("\n"); |
| 2772 |
buf.append("/**\n"); |
2833 |
buf.append("/**\n"); |
| 2773 |
buf.append(" * Testing the ActiveTest support\n"); |
2834 |
buf.append(" * Testing the ActiveTest support\n"); |
|
Lines 2892-2899
Link Here
|
| 2892 |
buf.append("\n"); |
2953 |
buf.append("\n"); |
| 2893 |
buf.append("import java.io.PrintStream;\n"); |
2954 |
buf.append("import java.io.PrintStream;\n"); |
| 2894 |
buf.append("\n"); |
2955 |
buf.append("\n"); |
| 2895 |
buf.append("import junit.framework.*;\n"); |
2956 |
buf.append("import junit.framework.Test;\n"); |
| 2896 |
buf.append("import junit.runner.*;\n"); |
2957 |
buf.append("import junit.framework.TestResult;\n"); |
|
|
2958 |
buf.append("import junit.framework.TestSuite;\n"); |
| 2959 |
buf.append("import junit.runner.BaseTestRunner;\n"); |
| 2960 |
buf.append("import junit.runner.StandardTestSuiteLoader;\n"); |
| 2961 |
buf.append("import junit.runner.TestSuiteLoader;\n"); |
| 2962 |
buf.append("import junit.runner.Version;\n"); |
| 2897 |
buf.append("\n"); |
2963 |
buf.append("\n"); |
| 2898 |
buf.append("/**\n"); |
2964 |
buf.append("/**\n"); |
| 2899 |
buf.append(" * A command line based tool to run tests.\n"); |
2965 |
buf.append(" * A command line based tool to run tests.\n"); |
|
Lines 3092-3098
Link Here
|
| 3092 |
buf.append("/**\n"); |
3158 |
buf.append("/**\n"); |
| 3093 |
buf.append(" * Test class used in TestTestCaseClassLoader\n"); |
3159 |
buf.append(" * Test class used in TestTestCaseClassLoader\n"); |
| 3094 |
buf.append(" */\n"); |
3160 |
buf.append(" */\n"); |
| 3095 |
buf.append("import junit.framework.*;\n"); |
3161 |
buf.append("import junit.framework.Assert;\n"); |
|
|
3162 |
buf.append("import junit.framework.TestCase;\n"); |
| 3096 |
buf.append("\n"); |
3163 |
buf.append("\n"); |
| 3097 |
buf.append("public class ClassLoaderTest extends Assert {\n"); |
3164 |
buf.append("public class ClassLoaderTest extends Assert {\n"); |
| 3098 |
buf.append(" public ClassLoaderTest() {\n"); |
3165 |
buf.append(" public ClassLoaderTest() {\n"); |
|
Lines 3281-3288
Link Here
|
| 3281 |
buf= new StringBuffer(); |
3348 |
buf= new StringBuffer(); |
| 3282 |
buf.append("package junit.tests.extensions;\n"); |
3349 |
buf.append("package junit.tests.extensions;\n"); |
| 3283 |
buf.append("\n"); |
3350 |
buf.append("\n"); |
| 3284 |
buf.append("import junit.framework.*;\n"); |
3351 |
buf.append("import junit.extensions.TestSetup;\n"); |
| 3285 |
buf.append("import junit.extensions.*;\n"); |
3352 |
buf.append("import junit.framework.Assert;\n"); |
|
|
3353 |
buf.append("import junit.framework.Test;\n"); |
| 3354 |
buf.append("import junit.framework.TestCase;\n"); |
| 3355 |
buf.append("import junit.framework.TestResult;\n"); |
| 3356 |
buf.append("import junit.framework.TestSuite;\n"); |
| 3286 |
buf.append("import junit.tests.WasRun;\n"); |
3357 |
buf.append("import junit.tests.WasRun;\n"); |
| 3287 |
buf.append("\n"); |
3358 |
buf.append("\n"); |
| 3288 |
buf.append("/**\n"); |
3359 |
buf.append("/**\n"); |
|
Lines 3378-3384
Link Here
|
| 3378 |
buf= new StringBuffer(); |
3449 |
buf= new StringBuffer(); |
| 3379 |
buf.append("package junit.tests;\n"); |
3450 |
buf.append("package junit.tests;\n"); |
| 3380 |
buf.append("\n"); |
3451 |
buf.append("\n"); |
| 3381 |
buf.append("import junit.framework.*;\n"); |
3452 |
buf.append("import junit.framework.Test;\n"); |
|
|
3453 |
buf.append("import junit.framework.TestSuite;\n"); |
| 3382 |
buf.append("\n"); |
3454 |
buf.append("\n"); |
| 3383 |
buf.append("/**\n"); |
3455 |
buf.append("/**\n"); |
| 3384 |
buf.append(" * TestSuite that runs all the JUnit tests\n"); |
3456 |
buf.append(" * TestSuite that runs all the JUnit tests\n"); |
|
Lines 3405-3411
Link Here
|
| 3405 |
buf.append("/**\n"); |
3477 |
buf.append("/**\n"); |
| 3406 |
buf.append(" * Test class used in TestTestCaseClassLoader\n"); |
3478 |
buf.append(" * Test class used in TestTestCaseClassLoader\n"); |
| 3407 |
buf.append(" */\n"); |
3479 |
buf.append(" */\n"); |
| 3408 |
buf.append("import junit.framework.*;\n"); |
3480 |
buf.append("import junit.framework.Assert;\n"); |
| 3409 |
buf.append("\n"); |
3481 |
buf.append("\n"); |
| 3410 |
buf.append("public class LoadedFromJar extends Assert {\n"); |
3482 |
buf.append("public class LoadedFromJar extends Assert {\n"); |
| 3411 |
buf.append(" public void verify() {\n"); |
3483 |
buf.append(" public void verify() {\n"); |
|
Lines 3576-3584
Link Here
|
| 3576 |
buf.append(" }\n"); |
3648 |
buf.append(" }\n"); |
| 3577 |
buf.append(" }\n"); |
3649 |
buf.append(" }\n"); |
| 3578 |
buf.append("\n"); |
3650 |
buf.append("\n"); |
| 3579 |
buf.append(" public void printDefect(final TestFailure booBoo, final int count) { // only public\n"); |
3651 |
buf.append(" public void printDefect(final TestFailure booBoo, final int count) { // only\n"); |
| 3580 |
buf.append(" // for testing\n"); |
3652 |
buf.append(" // public\n"); |
| 3581 |
buf.append(" // purposes\n"); |
3653 |
buf.append(" // for\n"); |
|
|
3654 |
buf.append(" // testing\n"); |
| 3655 |
buf.append(" // purposes\n"); |
| 3582 |
buf.append(" this.printDefectHeader(booBoo, count);\n"); |
3656 |
buf.append(" this.printDefectHeader(booBoo, count);\n"); |
| 3583 |
buf.append(" this.printDefectTrace(booBoo);\n"); |
3657 |
buf.append(" this.printDefectTrace(booBoo);\n"); |
| 3584 |
buf.append(" }\n"); |
3658 |
buf.append(" }\n"); |
|
Lines 3661-3670
Link Here
|
| 3661 |
buf= new StringBuffer(); |
3735 |
buf= new StringBuffer(); |
| 3662 |
buf.append("package junit.samples;\n"); |
3736 |
buf.append("package junit.samples;\n"); |
| 3663 |
buf.append("\n"); |
3737 |
buf.append("\n"); |
| 3664 |
buf.append("import junit.framework.*;\n"); |
|
|
| 3665 |
buf.append("\n"); |
| 3666 |
buf.append("import java.util.Vector;\n"); |
3738 |
buf.append("import java.util.Vector;\n"); |
| 3667 |
buf.append("\n"); |
3739 |
buf.append("\n"); |
|
|
3740 |
buf.append("import junit.framework.Assert;\n"); |
| 3741 |
buf.append("import junit.framework.Test;\n"); |
| 3742 |
buf.append("import junit.framework.TestCase;\n"); |
| 3743 |
buf.append("import junit.framework.TestSuite;\n"); |
| 3744 |
buf.append("\n"); |
| 3668 |
buf.append("/**\n"); |
3745 |
buf.append("/**\n"); |
| 3669 |
buf.append(" * A sample test case, testing <code>java.util.Vector</code>.\n"); |
3746 |
buf.append(" * A sample test case, testing <code>java.util.Vector</code>.\n"); |
| 3670 |
buf.append(" * \n"); |
3747 |
buf.append(" * \n"); |
|
Lines 3814-3820
Link Here
|
| 3814 |
buf= new StringBuffer(); |
3891 |
buf= new StringBuffer(); |
| 3815 |
buf.append("package junit.tests.framework;\n"); |
3892 |
buf.append("package junit.tests.framework;\n"); |
| 3816 |
buf.append("\n"); |
3893 |
buf.append("\n"); |
| 3817 |
buf.append("import junit.framework.*;\n"); |
3894 |
buf.append("import junit.framework.Assert;\n"); |
|
|
3895 |
buf.append("import junit.framework.AssertionFailedError;\n"); |
| 3896 |
buf.append("import junit.framework.Test;\n"); |
| 3897 |
buf.append("import junit.framework.TestCase;\n"); |
| 3898 |
buf.append("import junit.framework.TestFailure;\n"); |
| 3899 |
buf.append("import junit.framework.TestResult;\n"); |
| 3900 |
buf.append("import junit.framework.TestSuite;\n"); |
| 3818 |
buf.append("import junit.tests.WasRun;\n"); |
3901 |
buf.append("import junit.tests.WasRun;\n"); |
| 3819 |
buf.append("\n"); |
3902 |
buf.append("\n"); |
| 3820 |
buf.append("/**\n"); |
3903 |
buf.append("/**\n"); |
|
Lines 4054-4060
Link Here
|
| 4054 |
buf.append(" */\n"); |
4137 |
buf.append(" */\n"); |
| 4055 |
buf.append("public class ReloadingTestSuiteLoader implements TestSuiteLoader {\n"); |
4138 |
buf.append("public class ReloadingTestSuiteLoader implements TestSuiteLoader {\n"); |
| 4056 |
buf.append("\n"); |
4139 |
buf.append("\n"); |
| 4057 |
buf.append(" public Class load(final String suiteClassName) throws ClassNotFoundException {\n"); |
4140 |
buf.append(" public Class load(final String suiteClassName)\n"); |
|
|
4141 |
buf.append(" throws ClassNotFoundException {\n"); |
| 4058 |
buf.append(" return this.createLoader().loadClass(suiteClassName, true);\n"); |
4142 |
buf.append(" return this.createLoader().loadClass(suiteClassName, true);\n"); |
| 4059 |
buf.append(" }\n"); |
4143 |
buf.append(" }\n"); |
| 4060 |
buf.append("\n"); |
4144 |
buf.append("\n"); |
|
Lines 4077-4083
Link Here
|
| 4077 |
buf.append(" /**\n"); |
4161 |
buf.append(" /**\n"); |
| 4078 |
buf.append(" * Uses the system class loader to load the test class\n"); |
4162 |
buf.append(" * Uses the system class loader to load the test class\n"); |
| 4079 |
buf.append(" */\n"); |
4163 |
buf.append(" */\n"); |
| 4080 |
buf.append(" public Class load(final String suiteClassName) throws ClassNotFoundException {\n"); |
4164 |
buf.append(" public Class load(final String suiteClassName)\n"); |
|
|
4165 |
buf.append(" throws ClassNotFoundException {\n"); |
| 4081 |
buf.append(" return Class.forName(suiteClassName);\n"); |
4166 |
buf.append(" return Class.forName(suiteClassName);\n"); |
| 4082 |
buf.append(" }\n"); |
4167 |
buf.append(" }\n"); |
| 4083 |
buf.append(" /**\n"); |
4168 |
buf.append(" /**\n"); |
|
Lines 4091-4097
Link Here
|
| 4091 |
buf= new StringBuffer(); |
4176 |
buf= new StringBuffer(); |
| 4092 |
buf.append("package junit.extensions;\n"); |
4177 |
buf.append("package junit.extensions;\n"); |
| 4093 |
buf.append("\n"); |
4178 |
buf.append("\n"); |
| 4094 |
buf.append("import junit.framework.*;\n"); |
4179 |
buf.append("import junit.framework.Protectable;\n"); |
|
|
4180 |
buf.append("import junit.framework.Test;\n"); |
| 4181 |
buf.append("import junit.framework.TestResult;\n"); |
| 4095 |
buf.append("\n"); |
4182 |
buf.append("\n"); |
| 4096 |
buf.append("/**\n"); |
4183 |
buf.append("/**\n"); |
| 4097 |
buf.append(" * A Decorator to set up and tear down additional fixture state. Subclass\n"); |
4184 |
buf.append(" * A Decorator to set up and tear down additional fixture state. Subclass\n"); |
|
Lines 4199-4205
Link Here
|
| 4199 |
buf= new StringBuffer(); |
4286 |
buf= new StringBuffer(); |
| 4200 |
buf.append("package junit.tests.framework;\n"); |
4287 |
buf.append("package junit.tests.framework;\n"); |
| 4201 |
buf.append("\n"); |
4288 |
buf.append("\n"); |
| 4202 |
buf.append("import junit.framework.*;\n"); |
4289 |
buf.append("import junit.framework.Assert;\n"); |
|
|
4290 |
buf.append("import junit.framework.TestCase;\n"); |
| 4203 |
buf.append("\n"); |
4291 |
buf.append("\n"); |
| 4204 |
buf.append("/**\n"); |
4292 |
buf.append("/**\n"); |
| 4205 |
buf.append(" * A test case testing the testing framework.\n"); |
4293 |
buf.append(" * A test case testing the testing framework.\n"); |
|
Lines 4227-4233
Link Here
|
| 4227 |
buf= new StringBuffer(); |
4315 |
buf= new StringBuffer(); |
| 4228 |
buf.append("package junit.extensions;\n"); |
4316 |
buf.append("package junit.extensions;\n"); |
| 4229 |
buf.append("\n"); |
4317 |
buf.append("\n"); |
| 4230 |
buf.append("import junit.framework.*;\n"); |
4318 |
buf.append("import junit.framework.Test;\n"); |
|
|
4319 |
buf.append("import junit.framework.TestResult;\n"); |
| 4231 |
buf.append("\n"); |
4320 |
buf.append("\n"); |
| 4232 |
buf.append("/**\n"); |
4321 |
buf.append("/**\n"); |
| 4233 |
buf.append(" * A Decorator that runs a test repeatedly.\n"); |
4322 |
buf.append(" * A Decorator that runs a test repeatedly.\n"); |
|
Lines 4276-4282
Link Here
|
| 4276 |
buf= new StringBuffer(); |
4365 |
buf= new StringBuffer(); |
| 4277 |
buf.append("package junit.runner;\n"); |
4366 |
buf.append("package junit.runner;\n"); |
| 4278 |
buf.append("\n"); |
4367 |
buf.append("\n"); |
| 4279 |
buf.append("import java.util.*;\n"); |
4368 |
buf.append("import java.util.Vector;\n"); |
| 4280 |
buf.append("\n"); |
4369 |
buf.append("\n"); |
| 4281 |
buf.append("/**\n"); |
4370 |
buf.append("/**\n"); |
| 4282 |
buf.append(" * A custom quick sort with support to customize the swap behaviour. NOTICE: We\n"); |
4371 |
buf.append(" * A custom quick sort with support to customize the swap behaviour. NOTICE: We\n"); |
|
Lines 4319-4325
Link Here
|
| 4319 |
buf= new StringBuffer(); |
4408 |
buf= new StringBuffer(); |
| 4320 |
buf.append("package junit.tests.framework;\n"); |
4409 |
buf.append("package junit.tests.framework;\n"); |
| 4321 |
buf.append("\n"); |
4410 |
buf.append("\n"); |
| 4322 |
buf.append("import junit.framework.*;\n"); |
4411 |
buf.append("import junit.framework.Test;\n"); |
|
|
4412 |
buf.append("import junit.framework.TestSuite;\n"); |
| 4323 |
buf.append("\n"); |
4413 |
buf.append("\n"); |
| 4324 |
buf.append("/**\n"); |
4414 |
buf.append("/**\n"); |
| 4325 |
buf.append(" * TestSuite that runs all the sample tests\n"); |
4415 |
buf.append(" * TestSuite that runs all the sample tests\n"); |
|
Lines 4335-4341
Link Here
|
| 4335 |
buf.append(" final TestSuite suite = new TestSuite(\"Framework Tests\"); //$NON-NLS-1$\n"); |
4425 |
buf.append(" final TestSuite suite = new TestSuite(\"Framework Tests\"); //$NON-NLS-1$\n"); |
| 4336 |
buf.append(" suite.addTestSuite(TestCaseTest.class);\n"); |
4426 |
buf.append(" suite.addTestSuite(TestCaseTest.class);\n"); |
| 4337 |
buf.append(" suite.addTest(SuiteTest.suite()); // Tests suite building, so can't\n"); |
4427 |
buf.append(" suite.addTest(SuiteTest.suite()); // Tests suite building, so can't\n"); |
| 4338 |
buf.append(" // use automatic test extraction\n"); |
4428 |
buf.append(" // use automatic test extraction\n"); |
| 4339 |
buf.append(" suite.addTestSuite(TestListenerTest.class);\n"); |
4429 |
buf.append(" suite.addTestSuite(TestListenerTest.class);\n"); |
| 4340 |
buf.append(" suite.addTestSuite(AssertTest.class);\n"); |
4430 |
buf.append(" suite.addTestSuite(AssertTest.class);\n"); |
| 4341 |
buf.append(" suite.addTestSuite(TestImplementorTest.class);\n"); |
4431 |
buf.append(" suite.addTestSuite(TestImplementorTest.class);\n"); |
|
Lines 4350-4357
Link Here
|
| 4350 |
buf= new StringBuffer(); |
4440 |
buf= new StringBuffer(); |
| 4351 |
buf.append("package junit.tests.extensions;\n"); |
4441 |
buf.append("package junit.tests.extensions;\n"); |
| 4352 |
buf.append("\n"); |
4442 |
buf.append("\n"); |
| 4353 |
buf.append("import junit.framework.*;\n"); |
|
|
| 4354 |
buf.append("import junit.extensions.RepeatedTest;\n"); |
4443 |
buf.append("import junit.extensions.RepeatedTest;\n"); |
|
|
4444 |
buf.append("import junit.framework.Assert;\n"); |
| 4445 |
buf.append("import junit.framework.Test;\n"); |
| 4446 |
buf.append("import junit.framework.TestCase;\n"); |
| 4447 |
buf.append("import junit.framework.TestResult;\n"); |
| 4448 |
buf.append("import junit.framework.TestSuite;\n"); |
| 4355 |
buf.append("\n"); |
4449 |
buf.append("\n"); |
| 4356 |
buf.append("/**\n"); |
4450 |
buf.append("/**\n"); |
| 4357 |
buf.append(" * Testing the RepeatedTest support.\n"); |
4451 |
buf.append(" * Testing the RepeatedTest support.\n"); |
|
Lines 4411-4417
Link Here
|
| 4411 |
buf= new StringBuffer(); |
4505 |
buf= new StringBuffer(); |
| 4412 |
buf.append("package junit.tests.runner;\n"); |
4506 |
buf.append("package junit.tests.runner;\n"); |
| 4413 |
buf.append("\n"); |
4507 |
buf.append("\n"); |
| 4414 |
buf.append("import junit.framework.*;\n"); |
4508 |
buf.append("import junit.framework.Test;\n"); |
|
|
4509 |
buf.append("import junit.framework.TestSuite;\n"); |
| 4415 |
buf.append("import junit.runner.BaseTestRunner;\n"); |
4510 |
buf.append("import junit.runner.BaseTestRunner;\n"); |
| 4416 |
buf.append("\n"); |
4511 |
buf.append("\n"); |
| 4417 |
buf.append("/**\n"); |
4512 |
buf.append("/**\n"); |
|
Lines 4425-4431
Link Here
|
| 4425 |
buf.append(" }\n"); |
4520 |
buf.append(" }\n"); |
| 4426 |
buf.append("\n"); |
4521 |
buf.append("\n"); |
| 4427 |
buf.append(" public static Test suite() { // Collect tests manually because we have to\n"); |
4522 |
buf.append(" public static Test suite() { // Collect tests manually because we have to\n"); |
| 4428 |
buf.append(" // test class collection code\n"); |
4523 |
buf.append(" // test class collection code\n"); |
| 4429 |
buf.append(" final TestSuite suite = new TestSuite(\"Framework Tests\"); //$NON-NLS-1$\n"); |
4524 |
buf.append(" final TestSuite suite = new TestSuite(\"Framework Tests\"); //$NON-NLS-1$\n"); |
| 4430 |
buf.append(" suite.addTestSuite(StackFilterTest.class);\n"); |
4525 |
buf.append(" suite.addTestSuite(StackFilterTest.class);\n"); |
| 4431 |
buf.append(" suite.addTestSuite(SorterTest.class);\n"); |
4526 |
buf.append(" suite.addTestSuite(SorterTest.class);\n"); |
|
Lines 4450-4456
Link Here
|
| 4450 |
buf= new StringBuffer(); |
4545 |
buf= new StringBuffer(); |
| 4451 |
buf.append("package junit.runner;\n"); |
4546 |
buf.append("package junit.runner;\n"); |
| 4452 |
buf.append("\n"); |
4547 |
buf.append("\n"); |
| 4453 |
buf.append("import java.util.*;\n"); |
4548 |
buf.append("import java.util.Enumeration;\n"); |
| 4454 |
buf.append("\n"); |
4549 |
buf.append("\n"); |
| 4455 |
buf.append("/**\n"); |
4550 |
buf.append("/**\n"); |
| 4456 |
buf.append(" * Collects Test class names to be presented by the TestSelector.\n"); |
4551 |
buf.append(" * Collects Test class names to be presented by the TestSelector.\n"); |
|
Lines 4468-4474
Link Here
|
| 4468 |
buf= new StringBuffer(); |
4563 |
buf= new StringBuffer(); |
| 4469 |
buf.append("package junit.samples.money;\n"); |
4564 |
buf.append("package junit.samples.money;\n"); |
| 4470 |
buf.append("\n"); |
4565 |
buf.append("\n"); |
| 4471 |
buf.append("import java.util.*;\n"); |
4566 |
buf.append("import java.util.Enumeration;\n"); |
|
|
4567 |
buf.append("import java.util.Vector;\n"); |
| 4472 |
buf.append("\n"); |
4568 |
buf.append("\n"); |
| 4473 |
buf.append("/**\n"); |
4569 |
buf.append("/**\n"); |
| 4474 |
buf.append(" * A MoneyBag defers exchange rate conversions. For example adding 12 Swiss\n"); |
4570 |
buf.append(" * A MoneyBag defers exchange rate conversions. For example adding 12 Swiss\n"); |
|
Lines 4636-4642
Link Here
|
| 4636 |
buf= new StringBuffer(); |
4732 |
buf= new StringBuffer(); |
| 4637 |
buf.append("package junit.framework;\n"); |
4733 |
buf.append("package junit.framework;\n"); |
| 4638 |
buf.append("\n"); |
4734 |
buf.append("\n"); |
| 4639 |
buf.append("import java.lang.reflect.*;\n"); |
4735 |
buf.append("import java.lang.reflect.InvocationTargetException;\n"); |
|
|
4736 |
buf.append("import java.lang.reflect.Method;\n"); |
| 4737 |
buf.append("import java.lang.reflect.Modifier;\n"); |
| 4640 |
buf.append("\n"); |
4738 |
buf.append("\n"); |
| 4641 |
buf.append("/**\n"); |
4739 |
buf.append("/**\n"); |
| 4642 |
buf.append(" * A test case defines the fixture to run multiple tests. To define a test case<br>\n"); |
4740 |
buf.append(" * A test case defines the fixture to run multiple tests. To define a test case<br>\n"); |
|
Lines 4848-4854
Link Here
|
| 4848 |
buf= new StringBuffer(); |
4946 |
buf= new StringBuffer(); |
| 4849 |
buf.append("package junit.samples.money;\n"); |
4947 |
buf.append("package junit.samples.money;\n"); |
| 4850 |
buf.append("\n"); |
4948 |
buf.append("\n"); |
| 4851 |
buf.append("import junit.framework.*;\n"); |
4949 |
buf.append("import junit.framework.Assert;\n"); |
|
|
4950 |
buf.append("import junit.framework.TestCase;\n"); |
| 4852 |
buf.append("\n"); |
4951 |
buf.append("\n"); |
| 4853 |
buf.append("public class MoneyTest extends TestCase {\n"); |
4952 |
buf.append("public class MoneyTest extends TestCase {\n"); |
| 4854 |
buf.append(" private Money f12CHF;\n"); |
4953 |
buf.append(" private Money f12CHF;\n"); |
|
Lines 5005-5011
Link Here
|
| 5005 |
buf= new StringBuffer(); |
5104 |
buf= new StringBuffer(); |
| 5006 |
buf.append("package junit.tests.extensions;\n"); |
5105 |
buf.append("package junit.tests.extensions;\n"); |
| 5007 |
buf.append("\n"); |
5106 |
buf.append("\n"); |
| 5008 |
buf.append("import junit.framework.*;\n"); |
5107 |
buf.append("import junit.framework.Test;\n"); |
|
|
5108 |
buf.append("import junit.framework.TestSuite;\n"); |
| 5009 |
buf.append("\n"); |
5109 |
buf.append("\n"); |
| 5010 |
buf.append("/**\n"); |
5110 |
buf.append("/**\n"); |
| 5011 |
buf.append(" * TestSuite that runs all the extension tests\n"); |
5111 |
buf.append(" * TestSuite that runs all the extension tests\n"); |
|
Lines 5018-5024
Link Here
|
| 5018 |
buf.append(" }\n"); |
5118 |
buf.append(" }\n"); |
| 5019 |
buf.append("\n"); |
5119 |
buf.append("\n"); |
| 5020 |
buf.append(" public static Test suite() { // Collect tests manually because we have to\n"); |
5120 |
buf.append(" public static Test suite() { // Collect tests manually because we have to\n"); |
| 5021 |
buf.append(" // test class collection code\n"); |
5121 |
buf.append(" // test class collection code\n"); |
| 5022 |
buf.append(" final TestSuite suite = new TestSuite(\"Framework Tests\"); //$NON-NLS-1$\n"); |
5122 |
buf.append(" final TestSuite suite = new TestSuite(\"Framework Tests\"); //$NON-NLS-1$\n"); |
| 5023 |
buf.append(" suite.addTestSuite(ExtensionTest.class);\n"); |
5123 |
buf.append(" suite.addTestSuite(ExtensionTest.class);\n"); |
| 5024 |
buf.append(" suite.addTestSuite(ExceptionTestCaseTest.class);\n"); |
5124 |
buf.append(" suite.addTestSuite(ExceptionTestCaseTest.class);\n"); |
|
Lines 5044-5054
Link Here
|
| 5044 |
buf= new StringBuffer(); |
5144 |
buf= new StringBuffer(); |
| 5045 |
buf.append("package junit.tests.runner;\n"); |
5145 |
buf.append("package junit.tests.runner;\n"); |
| 5046 |
buf.append("\n"); |
5146 |
buf.append("\n"); |
| 5047 |
buf.append("import java.lang.reflect.*;\n"); |
5147 |
buf.append("import java.lang.reflect.Method;\n"); |
| 5048 |
buf.append("import junit.framework.*;\n"); |
|
|
| 5049 |
buf.append("import junit.runner.*;\n"); |
| 5050 |
buf.append("import java.net.URL;\n"); |
5148 |
buf.append("import java.net.URL;\n"); |
| 5051 |
buf.append("\n"); |
5149 |
buf.append("\n"); |
|
|
5150 |
buf.append("import junit.framework.Assert;\n"); |
| 5151 |
buf.append("import junit.framework.TestCase;\n"); |
| 5152 |
buf.append("import junit.runner.TestCaseClassLoader;\n"); |
| 5153 |
buf.append("\n"); |
| 5052 |
buf.append("/**\n"); |
5154 |
buf.append("/**\n"); |
| 5053 |
buf.append(" * A TestCase for testing the TestCaseClassLoader\n"); |
5155 |
buf.append(" * A TestCase for testing the TestCaseClassLoader\n"); |
| 5054 |
buf.append(" * \n"); |
5156 |
buf.append(" * \n"); |
|
Lines 5173-5179
Link Here
|
| 5173 |
buf.append("}"); |
5275 |
buf.append("}"); |
| 5174 |
fExpectedChangesAllTests.put("junit.samples.money.Money.java", buf.toString()); |
5276 |
fExpectedChangesAllTests.put("junit.samples.money.Money.java", buf.toString()); |
| 5175 |
} |
5277 |
} |
| 5176 |
|
5278 |
|
| 5177 |
public void testAllCleanUps() throws Exception { |
5279 |
public void testAllCleanUps() throws Exception { |
| 5178 |
List cus= new ArrayList(); |
5280 |
List cus= new ArrayList(); |
| 5179 |
addAllCUs(MyTestSetup.fJProject1.getChildren(), cus); |
5281 |
addAllCUs(MyTestSetup.fJProject1.getChildren(), cus); |
|
Lines 5235-5240
Link Here
|
| 5235 |
node.put(CleanUpConstants.FORMAT_SINGLE_LINE_COMMENT, CleanUpConstants.TRUE); |
5337 |
node.put(CleanUpConstants.FORMAT_SINGLE_LINE_COMMENT, CleanUpConstants.TRUE); |
| 5236 |
|
5338 |
|
| 5237 |
node.put(CleanUpConstants.FORMAT_SOURCE_CODE, CleanUpConstants.TRUE); |
5339 |
node.put(CleanUpConstants.FORMAT_SOURCE_CODE, CleanUpConstants.TRUE); |
|
|
5340 |
|
| 5341 |
node.put(CleanUpConstants.ORGANIZE_IMPORTS, CleanUpConstants.TRUE); |
| 5238 |
|
5342 |
|
| 5239 |
ICompilationUnit[] units= (ICompilationUnit[])cus.toArray(new ICompilationUnit[cus.size()]); |
5343 |
ICompilationUnit[] units= (ICompilationUnit[])cus.toArray(new ICompilationUnit[cus.size()]); |
| 5240 |
Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); |
5344 |
Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); |