From: David S. <ds...@us...> - 2006-02-15 22:56:11
|
Update of /cvsroot/junit/junit/junit/tests/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13390/junit/tests/framework Modified Files: TestImplementorTest.java AssertTest.java TestCaseTest.java DoublePrecisionAssertTest.java Success.java AllTests.java Failure.java OverrideTestCase.java TestListenerTest.java SuiteTest.java Added Files: FloatAssertTest.java Log Message: Merged with branch, Kent will make final changes and launch. Index: TestImplementorTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/TestImplementorTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TestImplementorTest.java 9 Sep 2004 21:53:55 -0000 1.3 +++ TestImplementorTest.java 15 Feb 2006 22:55:32 -0000 1.4 @@ -37,6 +37,7 @@ public TestImplementorTest() { TestCase testCase= new TestCase() { + @Override public void runTest() { } }; Index: AssertTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/AssertTest.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- AssertTest.java 1 Sep 2002 15:29:53 -0000 1.9 +++ AssertTest.java 15 Feb 2006 22:55:32 -0000 1.10 @@ -38,7 +38,7 @@ } public void testAssertEqualsNull() { - assertEquals(null, null); + assertEquals((Object) null, (Object) null); } public void testAssertStringEquals() { Index: TestCaseTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/TestCaseTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- TestCaseTest.java 11 Oct 2004 19:22:09 -0000 1.7 +++ TestCaseTest.java 15 Feb 2006 22:55:32 -0000 1.8 @@ -17,9 +17,11 @@ static class TornDown extends TestCase { boolean fTornDown= false; + @Override protected void tearDown() { fTornDown= true; } + @Override protected void runTest() { throw new Error("running"); } @@ -33,6 +35,7 @@ } public void testError() { TestCase error= new TestCase("error") { + @Override protected void runTest() { throw new Error(); } @@ -41,10 +44,12 @@ } public void testRunAndTearDownFails() { TornDown fails= new TornDown() { + @Override protected void tearDown() { super.tearDown(); throw new Error(); } + @Override protected void runTest() { throw new Error(); } @@ -54,9 +59,11 @@ } public void testSetupFails() { TestCase fails= new TestCase("success") { + @Override protected void setUp() { throw new Error(); } + @Override protected void runTest() { } }; @@ -64,6 +71,7 @@ } public void testSuccess() { TestCase success= new TestCase("success") { + @Override protected void runTest() { } }; @@ -71,6 +79,7 @@ } public void testFailure() { TestCase failure= new TestCase("failure") { + @Override protected void runTest() { fail(); } @@ -86,9 +95,11 @@ public void testTearDownFails() { TestCase fails= new TestCase("success") { + @Override protected void tearDown() { throw new Error(); } + @Override protected void runTest() { } }; @@ -96,6 +107,7 @@ } public void testTearDownSetupFails() { TornDown fails= new TornDown() { + @Override protected void setUp() { throw new Error(); } @@ -113,22 +125,25 @@ // wrap the exception thrown while running with the exception thrown // while tearing down Test t= new TornDown() { + @Override public void tearDown() { throw new Error("tearingDown"); } }; TestResult result= new TestResult(); t.run(result); - TestFailure failure= (TestFailure) result.errors().nextElement(); + TestFailure failure= result.errors().nextElement(); assertEquals("running", failure.thrownException().getMessage()); } public void testErrorTearingDownDoesntMaskErrorRunning() { final Exception running= new Exception("Running"); TestCase t= new TestCase() { + @Override protected void runTest() throws Throwable { throw running; } + @Override protected void tearDown() throws Exception { throw new Error("Tearing down"); } Index: DoublePrecisionAssertTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/DoublePrecisionAssertTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- DoublePrecisionAssertTest.java 23 Oct 2004 01:06:41 -0000 1.3 +++ DoublePrecisionAssertTest.java 15 Feb 2006 22:55:32 -0000 1.4 @@ -11,19 +11,17 @@ public void testAssertEqualsNaNFails() { try { assertEquals(1.234, Double.NaN, 0.0); + fail(); } catch (AssertionFailedError e) { - return; } - fail(); } public void testAssertNaNEqualsFails() { try { assertEquals(Double.NaN, 1.234, 0.0); + fail(); } catch (AssertionFailedError e) { - return; } - fail(); } public void testAssertNaNEqualsNaN() { @@ -33,19 +31,17 @@ public void testAssertPosInfinityNotEqualsNegInfinity() { try { assertEquals(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0.0); + fail(); } catch (AssertionFailedError e) { - return; } - fail(); } public void testAssertPosInfinityNotEquals() { try { assertEquals(Double.POSITIVE_INFINITY, 1.23, 0.0); + fail(); } catch (AssertionFailedError e) { - return; } - fail(); } public void testAssertPosInfinityEqualsInfinity() { Index: Success.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/Success.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Success.java 9 Sep 2004 21:53:55 -0000 1.4 +++ Success.java 15 Feb 2006 22:55:32 -0000 1.5 @@ -8,6 +8,7 @@ */ public class Success extends TestCase { + @Override public void runTest() { } Index: AllTests.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/AllTests.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- AllTests.java 24 Oct 2004 06:41:48 -0000 1.7 +++ AllTests.java 15 Feb 2006 22:55:32 -0000 1.8 @@ -24,6 +24,7 @@ suite.addTestSuite(ComparisonCompactorTest.class); suite.addTestSuite(ComparisonFailureTest.class); suite.addTestSuite(DoublePrecisionAssertTest.class); + suite.addTestSuite(FloatAssertTest.class); return suite; } Index: Failure.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/Failure.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Failure.java 9 Sep 2004 21:53:55 -0000 1.4 +++ Failure.java 15 Feb 2006 22:55:32 -0000 1.5 @@ -7,6 +7,7 @@ * */ public class Failure extends TestCase { + @Override public void runTest() { fail(); } Index: OverrideTestCase.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/OverrideTestCase.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- OverrideTestCase.java 30 Mar 2002 22:37:40 -0000 1.2 +++ OverrideTestCase.java 15 Feb 2006 22:55:32 -0000 1.3 @@ -4,6 +4,7 @@ * Test class used in SuiteTest */ public class OverrideTestCase extends OneTestCase { + @Override public void testCase() { } } \ No newline at end of file Index: TestListenerTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/TestListenerTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TestListenerTest.java 9 Sep 2004 21:53:55 -0000 1.3 +++ TestListenerTest.java 15 Feb 2006 22:55:32 -0000 1.4 @@ -25,6 +25,7 @@ public void endTest(Test test) { fEndCount++; } + @Override protected void setUp() { fResult= new TestResult(); fResult.addListener(this); @@ -38,6 +39,7 @@ } public void testError() { TestCase test= new TestCase("noop") { + @Override public void runTest() { throw new Error(); } @@ -48,6 +50,7 @@ } public void testFailure() { TestCase test= new TestCase("noop") { + @Override public void runTest() { fail(); } @@ -58,6 +61,7 @@ } public void testStartStop() { TestCase test= new TestCase("noop") { + @Override public void runTest() { } }; Index: SuiteTest.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/framework/SuiteTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- SuiteTest.java 23 Oct 2004 22:06:58 -0000 1.6 +++ SuiteTest.java 15 Feb 2006 22:55:32 -0000 1.7 @@ -14,6 +14,7 @@ public SuiteTest(String name) { super(name); } + @Override protected void setUp() { fResult= new TestResult(); } @@ -21,7 +22,6 @@ TestSuite suite= new TestSuite("Suite Tests"); // build the suite manually, because some of the suites are testing // the functionality that automatically builds suites - suite.addTest(new SuiteTest("testNoTestCaseClass")); suite.addTest(new SuiteTest("testNoTestCases")); suite.addTest(new SuiteTest("testOneTestCase")); suite.addTest(new SuiteTest("testNotPublicTestCase")); @@ -40,12 +40,13 @@ assertTrue(fResult.wasSuccessful()); assertEquals(2, fResult.runCount()); } - public void testNoTestCaseClass() { - Test t= new TestSuite(NoTestCaseClass.class); - t.run(fResult); - assertEquals(1, fResult.runCount()); // warning test - assertTrue(! fResult.wasSuccessful()); - } +// This test case is obsolete, since the compiler will catch this error in 1.5 +// public void testNoTestCaseClass() { +// Test t= new TestSuite(NoTestCaseClass.class); +// t.run(fResult); +// assertEquals(1, fResult.runCount()); // warning test +// assertTrue(! fResult.wasSuccessful()); +// } public void testNoTestCases() { Test t= new TestSuite(NoTestCases.class); t.run(fResult); @@ -89,8 +90,7 @@ assertEquals(1, fResult.runCount()); } public void testCreateSuiteFromArray() { - Class[] testClassArray = { OneTestCase.class, DoublePrecisionAssertTest.class }; - TestSuite suite = new TestSuite(testClassArray); + TestSuite suite = new TestSuite(OneTestCase.class, DoublePrecisionAssertTest.class); assertEquals(2, suite.testCount()); assertEquals("junit.tests.framework.DoublePrecisionAssertTest" , ((TestSuite)suite.testAt(1)).getName()); assertEquals("junit.tests.framework.OneTestCase" , ((TestSuite)suite.testAt(0)).getName()); |