Update of /cvsroot/junit/junit/src/org/junit/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30152/src/org/junit/tests Modified Files: ForwardCompatibilityTest.java OldTestClassRunnerTest.java InaccessibleBaseClassTest.java ParameterizedTestMethodTest.java InitializationErrorForwardCompatibilityTest.java SingleMethodTest.java SortableTest.java OldTestClassAdaptingListenerTest.java TextListenerTest.java AnnotationTest.java TestMethodTest.java UserStopTest.java ParameterizedTestTest.java ValidationTest.java Log Message: Runner rearchitecting to begin 4.4 development Index: ForwardCompatibilityTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/ForwardCompatibilityTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ForwardCompatibilityTest.java 21 Feb 2007 14:44:00 -0000 1.2 +++ ForwardCompatibilityTest.java 20 Mar 2007 14:43:49 -0000 1.3 @@ -169,6 +169,7 @@ public static class InvalidMethodTest { @BeforeClass public void shouldBeStatic() {} + @Test public void aTest() {} } public void testInvalidMethod() { Index: OldTestClassRunnerTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/OldTestClassRunnerTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- OldTestClassRunnerTest.java 6 Dec 2006 01:22:48 -0000 1.2 +++ OldTestClassRunnerTest.java 20 Mar 2007 14:43:49 -0000 1.3 @@ -7,7 +7,7 @@ import junit.framework.TestSuite; import org.junit.Assert; import org.junit.Test; -import org.junit.internal.runners.OldTestClassRunner; +import org.junit.internal.runners.JUnit38ClassRunner; import org.junit.runner.Description; import org.junit.runner.JUnitCore; import org.junit.runner.Result; @@ -21,7 +21,7 @@ } @Test public void plansDecoratorCorrectly() { - OldTestClassRunner runner= new OldTestClassRunner(new TestDecorator(new TestSuite(MyTest.class))); + JUnit38ClassRunner runner= new JUnit38ClassRunner(new TestDecorator(new TestSuite(MyTest.class))); assertEquals(1, runner.testCount()); } @@ -32,7 +32,7 @@ } @Test public void canUnadaptAnAdapter() { - OldTestClassRunner runner= new OldTestClassRunner(new JUnit4TestAdapter(AnnotatedTest.class)); + JUnit38ClassRunner runner= new JUnit38ClassRunner(new JUnit4TestAdapter(AnnotatedTest.class)); Result result= new JUnitCore().run(runner); Failure failure= result.getFailures().get(0); assertEquals(Description.createTestDescription(AnnotatedTest.class, "foo"), failure.getDescription()); Index: InaccessibleBaseClassTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/InaccessibleBaseClassTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- InaccessibleBaseClassTest.java 21 Feb 2007 14:46:51 -0000 1.2 +++ InaccessibleBaseClassTest.java 20 Mar 2007 14:43:49 -0000 1.3 @@ -3,12 +3,13 @@ import org.junit.Test; import org.junit.internal.runners.InitializationError; import org.junit.internal.runners.MethodValidator; +import org.junit.internal.runners.TestClass; import org.junit.tests.anotherpackage.Sub; public class InaccessibleBaseClassTest { @Test(expected=InitializationError.class) public void inaccessibleBaseClassIsCaughtAtValidation() throws InitializationError { - MethodValidator methodValidator= new MethodValidator(Sub.class); + MethodValidator methodValidator= new MethodValidator(new TestClass(Sub.class)); methodValidator.validateMethodsForDefaultRunner(); methodValidator.assertValid(); } Index: ParameterizedTestMethodTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/ParameterizedTestMethodTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ParameterizedTestMethodTest.java 21 Nov 2006 18:53:34 -0000 1.1 +++ ParameterizedTestMethodTest.java 20 Mar 2007 14:43:49 -0000 1.2 @@ -14,7 +14,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.internal.runners.InitializationError; -import org.junit.internal.runners.TestClassRunner; +import org.junit.internal.runners.JUnit4ClassRunner; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @@ -85,7 +85,7 @@ private List<Throwable> validateAllMethods(Class<?> clazz) { try { - new TestClassRunner(clazz); + new JUnit4ClassRunner(clazz); } catch (InitializationError e) { return e.getCauses(); } Index: InitializationErrorForwardCompatibilityTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/InitializationErrorForwardCompatibilityTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- InitializationErrorForwardCompatibilityTest.java 2 Mar 2007 16:19:25 -0000 1.3 +++ InitializationErrorForwardCompatibilityTest.java 20 Mar 2007 14:43:49 -0000 1.4 @@ -9,7 +9,7 @@ import junit.framework.TestResult; import org.junit.Before; import org.junit.Test; -import org.junit.internal.runners.TestClassRunner; +import org.junit.internal.runners.JUnit4ClassRunner; import org.junit.runner.Description; import org.junit.runner.RunWith; import org.junit.runner.Runner; @@ -91,7 +91,7 @@ assertTrue(shouldFail == listener.getError()); } - public static class InitializesWithError extends TestClassRunner { + public static class InitializesWithError extends JUnit4ClassRunner { public InitializesWithError(Class<?> klass) throws Exception { super(klass); throw new Exception(); Index: SingleMethodTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/SingleMethodTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SingleMethodTest.java 21 Nov 2006 18:53:33 -0000 1.1 +++ SingleMethodTest.java 20 Mar 2007 14:43:49 -0000 1.2 @@ -49,7 +49,7 @@ @Parameters public static Collection<Object[]> params() { return Parameterized.eachOne(1, 2); - } + } public ParameterizedOneTimeSetup(int x) { } Index: SortableTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/SortableTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SortableTest.java 2 Mar 2007 16:19:25 -0000 1.3 +++ SortableTest.java 20 Mar 2007 14:43:49 -0000 1.4 @@ -6,14 +6,11 @@ import org.junit.Before; import org.junit.Test; -import org.junit.internal.runners.InitializationError; -import org.junit.internal.runners.TestClassRunner; import org.junit.runner.Description; import org.junit.runner.JUnitCore; import org.junit.runner.Request; import org.junit.runner.RunWith; import org.junit.runner.Runner; -import org.junit.runner.manipulation.Sorter; import org.junit.runner.notification.RunNotifier; import org.junit.runners.Enclosed; @@ -116,10 +113,5 @@ Request unsorted= Request.aClass(Unsortable.class).sortWith(forward()); new JUnitCore().run(unsorted); } - - @Test public void testClassRunnerCanBeWrappedAroundUnsortable() throws InitializationError { - TestClassRunner runner= new TestClassRunner(Unsortable.class, new UnsortableRunner(Unsortable.class)); - runner.sort(new Sorter(forward())); - } } } Index: OldTestClassAdaptingListenerTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/OldTestClassAdaptingListenerTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- OldTestClassAdaptingListenerTest.java 2 Mar 2007 16:19:25 -0000 1.2 +++ OldTestClassAdaptingListenerTest.java 20 Mar 2007 14:43:49 -0000 1.3 @@ -5,7 +5,7 @@ import junit.framework.TestCase; import junit.framework.TestListener; import org.junit.Test; -import org.junit.internal.runners.OldTestClassRunner; +import org.junit.internal.runners.JUnit38ClassRunner; import org.junit.runner.Result; import org.junit.runner.notification.RunListener; import org.junit.runner.notification.RunNotifier; @@ -17,7 +17,7 @@ RunListener listener= result.createListener(); RunNotifier notifier= new RunNotifier(); notifier.addFirstListener(listener); - TestListener adaptingListener= OldTestClassRunner + TestListener adaptingListener= JUnit38ClassRunner .createAdaptingListener(notifier); TestCase testCase= new TestCase() { }; Index: TextListenerTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/TextListenerTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TextListenerTest.java 6 Dec 2006 01:22:48 -0000 1.2 +++ TextListenerTest.java 20 Mar 2007 14:43:49 -0000 1.3 @@ -6,7 +6,7 @@ import junit.framework.TestCase; import org.junit.Test; -import org.junit.internal.runners.TextListener; +import org.junit.internal.TextListener; import org.junit.runner.JUnitCore; public class TextListenerTest extends TestCase { Index: AnnotationTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/AnnotationTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AnnotationTest.java 21 Nov 2006 18:53:33 -0000 1.1 +++ AnnotationTest.java 20 Mar 2007 14:43:49 -0000 1.2 @@ -264,6 +264,9 @@ static public class NonStaticOneTimeSetup { @BeforeClass public void once() { } + + @Test public void aTest() { + } } public void testNonStaticOneTimeSetup() throws Exception { Index: TestMethodTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/TestMethodTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- TestMethodTest.java 21 Feb 2007 14:46:51 -0000 1.4 +++ TestMethodTest.java 20 Mar 2007 14:43:49 -0000 1.5 @@ -16,7 +16,8 @@ import org.junit.Test; import org.junit.internal.runners.InitializationError; import org.junit.internal.runners.MethodValidator; -import org.junit.internal.runners.TestClassRunner; +import org.junit.internal.runners.TestClass; +import org.junit.internal.runners.JUnit4ClassRunner; import org.junit.runner.JUnitCore; import org.junit.runner.Result; @@ -86,7 +87,7 @@ private List<Throwable> validateAllMethods(Class<?> clazz) { try { - new TestClassRunner(clazz); + new JUnit4ClassRunner(clazz); } catch (InitializationError e) { return e.getCauses(); } @@ -120,7 +121,7 @@ } @Test public void overloaded() { - MethodValidator validator= new MethodValidator(Confused.class); + MethodValidator validator= new MethodValidator(new TestClass(Confused.class)); List<Throwable> errors= validator.validateMethodsForDefaultRunner(); assertEquals(1, errors.size()); } Index: UserStopTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/UserStopTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- UserStopTest.java 21 Nov 2006 18:53:33 -0000 1.1 +++ UserStopTest.java 20 Mar 2007 14:43:49 -0000 1.2 @@ -2,8 +2,6 @@ import org.junit.Before; import org.junit.Test; -import org.junit.internal.runners.TestMethodRunner; -import org.junit.runner.Description; import org.junit.runner.Request; import org.junit.runner.notification.RunNotifier; import org.junit.runner.notification.StoppedByUserException; @@ -20,10 +18,12 @@ fNotifier.fireTestStarted(null); } - @Test(expected=StoppedByUserException.class) public void stopMethodRunner() throws Exception { - new TestMethodRunner(this, OneTest.class.getMethod("foo"), fNotifier, - Description.createTestDescription(OneTest.class, "foo")).run(); - } + + // TODO: API is changing +// @Test(expected=StoppedByUserException.class) public void stopMethodRunner() throws Exception { +// new TestMethodRunner(this, OneTest.class.getMethod("foo"), fNotifier, +// Description.createTestDescription(OneTest.class, "foo")).run(); +// } public static class OneTest { @Test public void foo() {} Index: ParameterizedTestTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/ParameterizedTestTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ParameterizedTestTest.java 6 Dec 2006 01:22:48 -0000 1.2 +++ ParameterizedTestTest.java 20 Mar 2007 14:43:49 -0000 1.3 @@ -91,6 +91,9 @@ public static Collection<Object[]> data() { return Collections.emptyList(); } + + @Test public void aTest() { + } } @Test @@ -144,6 +147,9 @@ protected static Collection<Object[]> data() { return Collections.emptyList(); } + + @Test public void aTest() { + } } @Test @@ -161,6 +167,9 @@ public static Collection<String> data() { return Arrays.asList("a", "b", "c"); } + + @Test public void aTest() { + } } @Test public void meaningfulFailureWhenParameterListsAreNotArrays() { Index: ValidationTest.java =================================================================== RCS file: /cvsroot/junit/junit/src/org/junit/tests/ValidationTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ValidationTest.java 2 Mar 2007 16:19:25 -0000 1.3 +++ ValidationTest.java 20 Mar 2007 14:43:49 -0000 1.4 @@ -3,12 +3,7 @@ import static org.junit.Assert.assertEquals; import org.junit.BeforeClass; import org.junit.Test; -import org.junit.internal.runners.InitializationError; -import org.junit.internal.runners.TestClassRunner; -import org.junit.runner.Description; import org.junit.runner.Request; -import org.junit.runner.Runner; -import org.junit.runner.notification.RunNotifier; public class ValidationTest { public static class WrongBeforeClass { @@ -17,21 +12,6 @@ return 0; } } - - @Test(expected=InitializationError.class) - public void testClassRunnerHandlesBeforeClassAndAfterClassValidation() throws InitializationError { - new TestClassRunner(WrongBeforeClass.class, new Runner() { - @Override - public Description getDescription() { - return Description.EMPTY; - } - - @Override - public void run(RunNotifier notifier) { - // do nothing - } - }); - } @Test public void initializationErrorIsOnCorrectClass() { |