Lines 352-359
Link Here
|
352 |
buf.append(" return test;\n"); |
352 |
buf.append(" return test;\n"); |
353 |
buf.append(" }\n"); |
353 |
buf.append(" }\n"); |
354 |
buf.append(" } catch (final InvocationTargetException e) {\n"); |
354 |
buf.append(" } catch (final InvocationTargetException e) {\n"); |
355 |
buf.append(" this\n"); |
355 |
buf.append(" this.runFailed(\"Failed to invoke suite():\" + e.getTargetException().toString()); //$NON-NLS-1$\n"); |
356 |
buf.append(" .runFailed(\"Failed to invoke suite():\" + e.getTargetException().toString()); //$NON-NLS-1$\n"); |
|
|
357 |
buf.append(" return null;\n"); |
356 |
buf.append(" return null;\n"); |
358 |
buf.append(" } catch (final IllegalAccessException e) {\n"); |
357 |
buf.append(" } catch (final IllegalAccessException e) {\n"); |
359 |
buf.append(" this.runFailed(\"Failed to invoke suite():\" + e.toString()); //$NON-NLS-1$\n"); |
358 |
buf.append(" this.runFailed(\"Failed to invoke suite():\" + e.toString()); //$NON-NLS-1$\n"); |
Lines 475-492
Link Here
|
475 |
buf.append(" pwin.println(\" at java.lang.reflect.Method.invoke(Native Method)\"); //$NON-NLS-1$\n"); |
474 |
buf.append(" pwin.println(\" at java.lang.reflect.Method.invoke(Native Method)\"); //$NON-NLS-1$\n"); |
476 |
buf.append(" pwin.println(\" at junit.framework.TestCase.runTest(TestCase.java:156)\"); //$NON-NLS-1$\n"); |
475 |
buf.append(" pwin.println(\" at junit.framework.TestCase.runTest(TestCase.java:156)\"); //$NON-NLS-1$\n"); |
477 |
buf.append(" pwin.println(\" at junit.framework.TestCase.runBare(TestCase.java:130)\"); //$NON-NLS-1$\n"); |
476 |
buf.append(" pwin.println(\" at junit.framework.TestCase.runBare(TestCase.java:130)\"); //$NON-NLS-1$\n"); |
478 |
buf.append(" pwin\n"); |
477 |
buf.append(" pwin.println(\" at junit.framework.TestResult$1.protect(TestResult.java:100)\"); //$NON-NLS-1$\n"); |
479 |
buf.append(" .println(\" at junit.framework.TestResult$1.protect(TestResult.java:100)\"); //$NON-NLS-1$\n"); |
478 |
buf.append(" pwin.println(\" at junit.framework.TestResult.runProtected(TestResult.java:118)\"); //$NON-NLS-1$\n"); |
480 |
buf.append(" pwin\n"); |
|
|
481 |
buf.append(" .println(\" at junit.framework.TestResult.runProtected(TestResult.java:118)\"); //$NON-NLS-1$\n"); |
482 |
buf.append(" pwin.println(\" at junit.framework.TestResult.run(TestResult.java:103)\"); //$NON-NLS-1$\n"); |
479 |
buf.append(" pwin.println(\" at junit.framework.TestResult.run(TestResult.java:103)\"); //$NON-NLS-1$\n"); |
483 |
buf.append(" pwin.println(\" at junit.framework.TestCase.run(TestCase.java:121)\"); //$NON-NLS-1$\n"); |
480 |
buf.append(" pwin.println(\" at junit.framework.TestCase.run(TestCase.java:121)\"); //$NON-NLS-1$\n"); |
484 |
buf.append(" pwin\n"); |
481 |
buf.append(" pwin.println(\" at junit.framework.TestSuite.runTest(TestSuite.java:157)\"); //$NON-NLS-1$\n"); |
485 |
buf.append(" .println(\" at junit.framework.TestSuite.runTest(TestSuite.java:157)\"); //$NON-NLS-1$\n"); |
482 |
buf.append(" pwin.println(\" at junit.framework.TestSuite.run(TestSuite.java, Compiled Code)\"); //$NON-NLS-1$\n"); |
486 |
buf.append(" pwin\n"); |
483 |
buf.append(" pwin.println(\" at junit.swingui.TestRunner$17.run(TestRunner.java:669)\"); //$NON-NLS-1$\n"); |
487 |
buf.append(" .println(\" at junit.framework.TestSuite.run(TestSuite.java, Compiled Code)\"); //$NON-NLS-1$\n"); |
|
|
488 |
buf.append(" pwin\n"); |
489 |
buf.append(" .println(\" at junit.swingui.TestRunner$17.run(TestRunner.java:669)\"); //$NON-NLS-1$\n"); |
490 |
buf.append(" this.fUnfiltered = swin.toString();\n"); |
484 |
buf.append(" this.fUnfiltered = swin.toString();\n"); |
491 |
buf.append("\n"); |
485 |
buf.append("\n"); |
492 |
buf.append(" final StringWriter swout = new StringWriter();\n"); |
486 |
buf.append(" final StringWriter swout = new StringWriter();\n"); |
Lines 2088-2096
Link Here
|
2088 |
buf.append(" TestSuite.getTestConstructor(theClass); // Avoid generating multiple\n"); |
2082 |
buf.append(" TestSuite.getTestConstructor(theClass); // Avoid generating multiple\n"); |
2089 |
buf.append(" // error messages\n"); |
2083 |
buf.append(" // error messages\n"); |
2090 |
buf.append(" } catch (final NoSuchMethodException e) {\n"); |
2084 |
buf.append(" } catch (final NoSuchMethodException e) {\n"); |
2091 |
buf.append(" this\n"); |
2085 |
buf.append(" this.addTest(TestSuite\n"); |
2092 |
buf.append(" .addTest(TestSuite\n"); |
2086 |
buf.append(" .warning(\"Class \" + theClass.getName() + \" has no public constructor TestCase(String name) or TestCase()\")); //$NON-NLS-1$ //$NON-NLS-2$\n"); |
2093 |
buf.append(" .warning(\"Class \" + theClass.getName() + \" has no public constructor TestCase(String name) or TestCase()\")); //$NON-NLS-1$ //$NON-NLS-2$\n"); |
|
|
2094 |
buf.append(" return;\n"); |
2087 |
buf.append(" return;\n"); |
2095 |
buf.append(" }\n"); |
2088 |
buf.append(" }\n"); |
2096 |
buf.append("\n"); |
2089 |
buf.append("\n"); |
Lines 2379-2387
Link Here
|
2379 |
buf.append(" */\n"); |
2372 |
buf.append(" */\n"); |
2380 |
buf.append(" static public void assertEquals(final String message,\n"); |
2373 |
buf.append(" static public void assertEquals(final String message,\n"); |
2381 |
buf.append(" final boolean expected, final boolean actual) {\n"); |
2374 |
buf.append(" final boolean expected, final boolean actual) {\n"); |
2382 |
buf.append(" Assert\n"); |
2375 |
buf.append(" Assert.assertEquals(message, new Boolean(expected), new Boolean(actual));\n"); |
2383 |
buf.append(" .assertEquals(message, new Boolean(expected), new Boolean(\n"); |
|
|
2384 |
buf.append(" actual));\n"); |
2385 |
buf.append(" }\n"); |
2376 |
buf.append(" }\n"); |
2386 |
buf.append(" /**\n"); |
2377 |
buf.append(" /**\n"); |
2387 |
buf.append(" * Asserts that two bytes are equal. If they are not an AssertionFailedError\n"); |
2378 |
buf.append(" * Asserts that two bytes are equal. If they are not an AssertionFailedError\n"); |
Lines 2446-2454
Link Here
|
2446 |
buf.append(" */\n"); |
2437 |
buf.append(" */\n"); |
2447 |
buf.append(" static public void assertEquals(final String message, final int expected,\n"); |
2438 |
buf.append(" static public void assertEquals(final String message, final int expected,\n"); |
2448 |
buf.append(" final int actual) {\n"); |
2439 |
buf.append(" final int actual) {\n"); |
2449 |
buf.append(" Assert\n"); |
2440 |
buf.append(" Assert.assertEquals(message, new Integer(expected), new Integer(actual));\n"); |
2450 |
buf.append(" .assertEquals(message, new Integer(expected), new Integer(\n"); |
|
|
2451 |
buf.append(" actual));\n"); |
2452 |
buf.append(" }\n"); |
2441 |
buf.append(" }\n"); |
2453 |
buf.append(" /**\n"); |
2442 |
buf.append(" /**\n"); |
2454 |
buf.append(" * Asserts that two longs are equal. If they are not an AssertionFailedError\n"); |
2443 |
buf.append(" * Asserts that two longs are equal. If they are not an AssertionFailedError\n"); |
Lines 3504-3519
Link Here
|
3504 |
buf.append("\n"); |
3493 |
buf.append("\n"); |
3505 |
buf.append(" public void testComparisonErrorWithActualNull() {\n"); |
3494 |
buf.append(" public void testComparisonErrorWithActualNull() {\n"); |
3506 |
buf.append(" final ComparisonFailure failure = new ComparisonFailure(null, \"a\", null); //$NON-NLS-1$\n"); |
3495 |
buf.append(" final ComparisonFailure failure = new ComparisonFailure(null, \"a\", null); //$NON-NLS-1$\n"); |
3507 |
buf.append(" Assert\n"); |
3496 |
buf.append(" Assert.assertEquals(\"expected:<a> but was:<null>\", failure.getMessage()); //$NON-NLS-1$\n"); |
3508 |
buf.append(" .assertEquals(\n"); |
|
|
3509 |
buf.append(" \"expected:<a> but was:<null>\", failure.getMessage()); //$NON-NLS-1$\n"); |
3510 |
buf.append(" }\n"); |
3497 |
buf.append(" }\n"); |
3511 |
buf.append("\n"); |
3498 |
buf.append("\n"); |
3512 |
buf.append(" public void testComparisonErrorWithExpectedNull() {\n"); |
3499 |
buf.append(" public void testComparisonErrorWithExpectedNull() {\n"); |
3513 |
buf.append(" final ComparisonFailure failure = new ComparisonFailure(null, null, \"a\"); //$NON-NLS-1$\n"); |
3500 |
buf.append(" final ComparisonFailure failure = new ComparisonFailure(null, null, \"a\"); //$NON-NLS-1$\n"); |
3514 |
buf.append(" Assert\n"); |
3501 |
buf.append(" Assert.assertEquals(\"expected:<null> but was:<a>\", failure.getMessage()); //$NON-NLS-1$\n"); |
3515 |
buf.append(" .assertEquals(\n"); |
|
|
3516 |
buf.append(" \"expected:<null> but was:<a>\", failure.getMessage()); //$NON-NLS-1$\n"); |
3517 |
buf.append(" }\n"); |
3502 |
buf.append(" }\n"); |
3518 |
buf.append("}\n"); |
3503 |
buf.append("}\n"); |
3519 |
buf.append(""); |
3504 |
buf.append(""); |
Lines 3633-3640
Link Here
|
3633 |
buf.append(" if (result.wasSuccessful()) {\n"); |
3618 |
buf.append(" if (result.wasSuccessful()) {\n"); |
3634 |
buf.append(" this.getWriter().println();\n"); |
3619 |
buf.append(" this.getWriter().println();\n"); |
3635 |
buf.append(" this.getWriter().print(\"OK\"); //$NON-NLS-1$\n"); |
3620 |
buf.append(" this.getWriter().print(\"OK\"); //$NON-NLS-1$\n"); |
3636 |
buf.append(" this\n"); |
3621 |
buf.append(" this.getWriter()\n"); |
3637 |
buf.append(" .getWriter()\n"); |
|
|
3638 |
buf.append(" .println(\n"); |
3622 |
buf.append(" .println(\n"); |
3639 |
buf.append(" \" (\" + result.runCount() + \" test\" + (result.runCount() == 1 ? \"\" : \"s\") + \")\"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$\n"); |
3623 |
buf.append(" \" (\" + result.runCount() + \" test\" + (result.runCount() == 1 ? \"\" : \"s\") + \")\"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$\n"); |
3640 |
buf.append("\n"); |
3624 |
buf.append("\n"); |
Lines 3863-3871
Link Here
|
3863 |
buf.append(" // This test wins the award for twisted snake tail eating while\n"); |
3847 |
buf.append(" // This test wins the award for twisted snake tail eating while\n"); |
3864 |
buf.append(" // writing self tests. And you thought those weird anonymous\n"); |
3848 |
buf.append(" // writing self tests. And you thought those weird anonymous\n"); |
3865 |
buf.append(" // inner classes were bad...\n"); |
3849 |
buf.append(" // inner classes were bad...\n"); |
3866 |
buf.append(" Assert\n"); |
3850 |
buf.append(" Assert.assertEquals(\n"); |
3867 |
buf.append(" .assertEquals(\n"); |
3851 |
buf.append(" \"testCaseToString(junit.tests.framework.TestCaseTest)\", this.toString()); //$NON-NLS-1$\n"); |
3868 |
buf.append(" \"testCaseToString(junit.tests.framework.TestCaseTest)\", this.toString()); //$NON-NLS-1$\n"); |
|
|
3869 |
buf.append(" }\n"); |
3852 |
buf.append(" }\n"); |
3870 |
buf.append(" public void testError() {\n"); |
3853 |
buf.append(" public void testError() {\n"); |
3871 |
buf.append(" final TestCase error = new TestCase(\"error\") { //$NON-NLS-1$\n"); |
3854 |
buf.append(" final TestCase error = new TestCase(\"error\") { //$NON-NLS-1$\n"); |