Update of /cvsroot/junit/junit/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6163/org/junit/internal/runners Modified Files: Tag: saff_r41_runner_refactoring JavaMethod.java TestClassMethodsRunner.java JavaMethodList.java JavaTestInterpreter.java TestEnvironment.java JavaModelElement.java MethodValidator.java JavaClass.java TestClassRunner.java Removed Files: Tag: saff_r41_runner_refactoring PerTestNotifier.java TestMethodRunner.java Log Message: PerTestNotifier is gone Index: JavaMethod.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/Attic/JavaMethod.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -d -r1.1.2.4 -r1.1.2.5 --- JavaMethod.java 18 Oct 2006 18:22:14 -0000 1.1.2.4 +++ JavaMethod.java 18 Oct 2006 19:36:35 -0000 1.1.2.5 @@ -7,7 +7,12 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import org.junit.After; import org.junit.Before; @@ -15,7 +20,6 @@ import org.junit.Test; import org.junit.Test.None; import org.junit.runner.Description; -import org.junit.runner.notification.RunNotifier; // TODO: check names of various "run" methods @@ -30,28 +34,6 @@ fMethod= current; } - private boolean isShadowedBy(JavaMethod previousJavaMethod) { - Method previous= previousJavaMethod.fMethod; - if (!previous.getName().equals(fMethod.getName())) - return false; - if (previous.getParameterTypes().length != fMethod.getParameterTypes().length) - return false; - for (int i= 0; i < previous.getParameterTypes().length; i++) { - if (!previous.getParameterTypes()[i].equals(fMethod - .getParameterTypes()[i])) - return false; - } - return true; - } - - boolean isShadowedBy(List<JavaMethod> results) { - for (JavaMethod each : results) { - if (isShadowedBy(each)) - return true; - } - return false; - } - public Annotation getAnnotation(MethodAnnotation methodAnnotation) { return fMethod.getAnnotation(methodAnnotation.getAnnotationClass()); } @@ -94,30 +76,8 @@ return fMethod.getName(); } - void validateAsTestMethod(boolean isStatic, List<Throwable> errors) { - Method each= fMethod; - if (Modifier.isStatic(each.getModifiers()) != isStatic) { - String state= isStatic ? "should" : "should not"; - errors.add(new Exception("Method " + each.getName() + "() " + state - + " be static")); - } - if (!Modifier.isPublic(each.getDeclaringClass().getModifiers())) - errors - .add(new Exception("Class " - + each.getDeclaringClass().getName() - + " should be public")); - if (!Modifier.isPublic(each.getModifiers())) - errors.add(new Exception("Method " + each.getName() - + " should be public")); - if (each.getReturnType() != Void.TYPE) - errors.add(new Exception("Method " + each.getName() - + " should be void")); - if (each.getParameterTypes().length != 0) - errors.add(new Exception("Method " + each.getName() - + " should have no parameters")); - } - // TODO: push out + @Override public Description description() { return Description.createTestDescription(fJavaClass.getTestClass(), getName()); @@ -154,40 +114,93 @@ public void runWithoutBeforeAndAfter(TestEnvironment environment, Object test) { + // TODO: is this envious of environment? try { environment.getInterpreter().executeMethodBody(test, this); if (expectsException()) - environment - .addFailure(new AssertionError("Expected exception: " - + expectedException().getName())); + addFailure(environment.getRunNotifier(), new AssertionError( + "Expected exception: " + expectedException().getName())); } catch (InvocationTargetException e) { Throwable actual= e.getTargetException(); if (!expectsException()) - environment.addFailure(actual); + addFailure(environment.getRunNotifier(), actual); else if (isUnexpected(actual)) { String message= "Unexpected exception, expected<" + expectedException().getName() + "> but was<" + actual.getClass().getName() + ">"; - environment.addFailure(new Exception(message, actual)); + addFailure(environment.getRunNotifier(), new Exception(message, + actual)); } } catch (Throwable e) { - environment.addFailure(e); + // TODO: DUP on environment.getRunNotifier + addFailure(environment.getRunNotifier(), e); } } - void invokeTestMethod(RunNotifier notifier, JavaTestInterpreter interpreter) { + void invokeTestMethod(TestEnvironment testEnvironment) { Object test; try { test= getJavaClass().newInstance(); - } catch (InvocationTargetException e) { - notifier.testAborted(description(), e.getCause()); + } catch (Exception e) { + testEnvironment.getRunNotifier().testAborted(description(), e); return; + } + run(testEnvironment, test); + } + + void runWithoutTimeout(final Object test, + final TestEnvironment testEnvironment) { + // TODO: is this envious now? Yes + runWithBeforeAndAfter(new Runnable() { + public void run() { + runWithoutBeforeAndAfter(testEnvironment, test); + } + }, test, testEnvironment.getRunNotifier()); + // TODO: ugly + } + + void runWiteTimeout(long timeout, final Object test, + final TestEnvironment testEnvironment) { + ExecutorService service= Executors.newSingleThreadExecutor(); + Callable<Object> callable= new Callable<Object>() { + public Object call() throws Exception { + runWithoutTimeout(test, testEnvironment); + return null; + } + }; + Future<Object> result= service.submit(callable); + service.shutdown(); + try { + boolean terminated= service.awaitTermination(timeout, + TimeUnit.MILLISECONDS); + if (!terminated) + service.shutdownNow(); + result.get(timeout, TimeUnit.MILLISECONDS); // throws the exception + // if one occurred + // during the invocation + } catch (TimeoutException e) { + addFailure(testEnvironment.getRunNotifier(), new Exception(String + .format("test timed out after %d milliseconds", timeout))); } catch (Exception e) { - notifier.testAborted(description(), e); + // TODO: DUP + addFailure(testEnvironment.getRunNotifier(), e); + } + } + + void run(TestEnvironment environment, Object test) { + if (isIgnored()) { + environment.getRunNotifier().fireTestIgnored(description()); return; } - TestEnvironment testEnvironment= new TestEnvironment(interpreter, - new PerTestNotifier(notifier, description()), test); - testEnvironment.run(this); + environment.getRunNotifier().fireTestStarted(description()); + try { + long timeout= getTimeout(); + if (timeout > 0) + runWiteTimeout(timeout, test, environment); + else + runWithoutTimeout(test, environment); + } finally { + environment.getRunNotifier().fireTestFinished(description()); + } } } \ No newline at end of file Index: TestClassMethodsRunner.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/TestClassMethodsRunner.java,v retrieving revision 1.3.2.4 retrieving revision 1.3.2.5 diff -u -d -r1.3.2.4 -r1.3.2.5 --- TestClassMethodsRunner.java 18 Oct 2006 18:22:14 -0000 1.3.2.4 +++ TestClassMethodsRunner.java 18 Oct 2006 19:36:35 -0000 1.3.2.5 @@ -1,7 +1,5 @@ package org.junit.internal.runners; - -import org.junit.Test; import org.junit.runner.Description; import org.junit.runner.Runner; import org.junit.runner.manipulation.Filter; @@ -15,17 +13,13 @@ Sortable { private final JavaMethodList fTestMethods; - private final JavaClass fTestClass; - private final JavaTestInterpreter fInterpreter; // This assumes that some containing runner will perform validation of the // test methods public TestClassMethodsRunner(JavaClass klass, JavaTestInterpreter javaTestInterpreter) { - // TODO: DUP? - fTestClass= klass; - fTestMethods= klass.getMethods(Test.class, javaTestInterpreter); + fTestMethods= klass.getTestMethods(javaTestInterpreter); fInterpreter= javaTestInterpreter; } @@ -33,20 +27,12 @@ @Override public void run(RunNotifier notifier) { - if (fTestMethods.isEmpty()) - notifier.testAborted(getDescription(), new Exception( - "No runnable methods")); - for (JavaMethod method : fTestMethods) - method.invokeTestMethod(notifier, fInterpreter); + fTestMethods.run(new TestEnvironment(fInterpreter, notifier)); } @Override public Description getDescription() { - Description spec= Description.createSuiteDescription(fTestClass - .getName()); - for (JavaMethod method : fTestMethods) - spec.addChild(method.description()); - return spec; + return fTestMethods.description(); } public void filter(Filter filter) throws NoTestsRemainException { Index: JavaMethodList.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/Attic/JavaMethodList.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -d -r1.1.2.1 -r1.1.2.2 --- JavaMethodList.java 18 Oct 2006 17:07:05 -0000 1.1.2.1 +++ JavaMethodList.java 18 Oct 2006 19:36:35 -0000 1.1.2.2 @@ -1,32 +1,101 @@ package org.junit.internal.runners; +import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; +import java.util.List; +import org.junit.runner.Description; import org.junit.runner.manipulation.Filter; import org.junit.runner.manipulation.NoTestsRemainException; import org.junit.runner.manipulation.Sorter; -public class JavaMethodList extends ArrayList<JavaMethod> { +public class JavaMethodList extends JavaModelElement implements + Iterable<JavaMethod> { private static final long serialVersionUID= 1L; + private final JavaClass fJavaClass; + + private List<JavaMethod> fMethods= new ArrayList<JavaMethod>(); + + public JavaMethodList(JavaClass javaClass) { + fJavaClass= javaClass; + } + void filter(Filter filter) throws NoTestsRemainException { - for (Iterator<JavaMethod> iter= iterator(); iter.hasNext();) { + for (Iterator<JavaMethod> iter= fMethods.iterator(); iter.hasNext();) { JavaMethod method= iter.next(); if (!filter.shouldRun(method.description())) iter.remove(); } - if (isEmpty()) + if (fMethods.isEmpty()) throw new NoTestsRemainException(); } void filter(final Sorter sorter) { - Collections.sort(this, new Comparator<JavaMethod>() { + Collections.sort(fMethods, new Comparator<JavaMethod>() { public int compare(JavaMethod o1, JavaMethod o2) { return sorter.compare(o1.description(), o2.description()); } }); } + + @Override + public Class<? extends Annotation> getAfterAnnotation() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Class<? extends Annotation> getBeforeAnnotation() { + // TODO Auto-generated method stub + return null; + } + + @Override + public JavaClass getJavaClass() { + return fJavaClass; + } + + @Override + public String getName() { + return String.format("%s methods", fJavaClass.getName()); + } + + public Iterator<JavaMethod> iterator() { + return fMethods.iterator(); + } + + public void add(JavaMethod eachMethod) { + fMethods.add(eachMethod); + } + + public boolean isEmpty() { + return fMethods.isEmpty(); + } + + public void reverse() { + Collections.reverse(fMethods); + } + + @Override + public Description description() { + Description spec= Description.createSuiteDescription(fJavaClass + .getName()); + for (JavaMethod method : this) + spec.addChild(method.description()); + return spec; + } + + void run(TestEnvironment environment) { + if (isEmpty()) + // TODO: DUP + environment.getRunNotifier().testAborted(description(), new Exception( + "No runnable methods")); + for (JavaMethod method : this) { + method.invokeTestMethod(environment); + } + } } Index: JavaTestInterpreter.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/Attic/JavaTestInterpreter.java,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -d -r1.1.2.3 -r1.1.2.4 --- JavaTestInterpreter.java 18 Oct 2006 18:22:14 -0000 1.1.2.3 +++ JavaTestInterpreter.java 18 Oct 2006 19:36:35 -0000 1.1.2.4 @@ -25,10 +25,6 @@ javaMethod.invoke(test); } - public JavaClass interpretJavaClass(Class<?> superclass) { - return new JavaClass(superclass); - } - public Runner runnerFor(Class<?> klass) throws InitializationError { MethodValidator methodValidator= new MethodValidator(klass); validate(methodValidator); Index: TestEnvironment.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/Attic/TestEnvironment.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -d -r1.1.2.1 -r1.1.2.2 --- TestEnvironment.java 18 Oct 2006 17:07:05 -0000 1.1.2.1 +++ TestEnvironment.java 18 Oct 2006 19:36:35 -0000 1.1.2.2 @@ -3,126 +3,25 @@ */ package org.junit.internal.runners; -import java.lang.annotation.Annotation; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; + +import org.junit.runner.notification.RunNotifier; public class TestEnvironment { private final JavaTestInterpreter fInterpreter; - private final PerTestNotifier fNotifier; - - private final Object fTest; + final RunNotifier fNotifier; public TestEnvironment(JavaTestInterpreter interpreter, - PerTestNotifier notifier, Object test) { + RunNotifier notifier) { fInterpreter= interpreter; fNotifier= notifier; - fTest= test; - } - - void runAfters(Class<? extends Annotation> afterAnnotation, - JavaClass javaClass, Object test) { - List<JavaMethod> afters= javaClass.getMethods(afterAnnotation, - getInterpreter()); - for (JavaMethod after : afters) { - try { - after.invoke(test); - } catch (Throwable e) { - addFailure(e); - } - } - } - - public void runWithBeforeAndAfter(Runnable protectThis, - JavaModelElement element) { - // TODO: is this envious now? Yes - try { - runBefores(element, fTest); - protectThis.run(); - } catch (FailedBefore e) { - } finally { - runAfters(element.getAfterAnnotation(), element.getJavaClass(), fTest); - } - } - - private void runBefores(JavaModelElement element, Object test) throws FailedBefore { - // TODO: envious of environment? - try { - List<JavaMethod> befores= element.getJavaClass().getMethods( - element.getBeforeAnnotation(), getInterpreter()); - - // TODO: no auto-correct if wrong type on left side of new-style - // for? - for (JavaMethod before : befores) - before.invoke(test); - } catch (Throwable e) { - addFailure(e); - throw new FailedBefore(); - } - } - - void runWithoutTimeout(final JavaMethod javaMethod) { - runWithBeforeAndAfter(new Runnable() { - public void run() { - javaMethod.runWithoutBeforeAndAfter(TestEnvironment.this, fTest); - } - }, javaMethod); - } - - void runWithTimeout(long timeout, final JavaMethod method) { - ExecutorService service= Executors.newSingleThreadExecutor(); - Callable<Object> callable= new Callable<Object>() { - public Object call() throws Exception { - runWithoutTimeout(method); - return null; - } - }; - Future<Object> result= service.submit(callable); - service.shutdown(); - try { - boolean terminated= service.awaitTermination(timeout, - TimeUnit.MILLISECONDS); - if (!terminated) - service.shutdownNow(); - result.get(timeout, TimeUnit.MILLISECONDS); // throws the exception - // if one occurred - // during the invocation - } catch (TimeoutException e) { - addFailure(new Exception(String.format( - "test timed out after %d milliseconds", timeout))); - } catch (Exception e) { - addFailure(e); - } - } - - void addFailure(Throwable e) { - fNotifier.addFailure(e); - } - - void run(JavaMethod javaMethod) { - if (javaMethod.isIgnored()) { - fNotifier.fireTestIgnored(); - return; - } - fNotifier.fireTestStarted(); - try { - long timeout= javaMethod.getTimeout(); - if (timeout > 0) - runWithTimeout(timeout, javaMethod); - else - runWithoutTimeout(javaMethod); - } finally { - fNotifier.fireTestFinished(); - } } JavaTestInterpreter getInterpreter() { return fInterpreter; } + + public RunNotifier getRunNotifier() { + return fNotifier; + } } \ No newline at end of file Index: JavaModelElement.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/Attic/JavaModelElement.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -d -r1.1.2.2 -r1.1.2.3 --- JavaModelElement.java 18 Oct 2006 17:07:05 -0000 1.1.2.2 +++ JavaModelElement.java 18 Oct 2006 19:36:35 -0000 1.1.2.3 @@ -1,6 +1,12 @@ package org.junit.internal.runners; import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.util.List; + +import org.junit.runner.Description; +import org.junit.runner.notification.Failure; +import org.junit.runner.notification.RunNotifier; public abstract class JavaModelElement { public abstract String getName(); @@ -10,4 +16,48 @@ public abstract Class<? extends Annotation> getAfterAnnotation(); public abstract JavaClass getJavaClass(); + + public void addFailure(RunNotifier runNotifier, Throwable targetException) { + runNotifier.fireTestFailure(new Failure(description(), targetException)); + } + + protected abstract Description description(); + + void runAfters(Object test, RunNotifier runNotifier) { + // TODO: train wreck + for (Method after : getJavaClass().getMethods( + getAfterAnnotation())) { + try { + after.invoke(test); + } catch (Throwable e) { + addFailure(runNotifier, e); + } + } + } + + void runBefores(Object test, RunNotifier runNotifier) + throws FailedBefore { + try { + List<Method> befores= getJavaClass().getMethods( + getBeforeAnnotation()); + + // TODO: no auto-correct if wrong type on left side of new-style + // for? + for (Method before : befores) + before.invoke(test); + } catch (Throwable e) { + addFailure(runNotifier, e); + throw new FailedBefore(); + } + } + + void runWithBeforeAndAfter(Runnable protectThis, Object test, RunNotifier runNotifier) { + try { + runBefores(test, runNotifier); + protectThis.run(); + } catch (FailedBefore e) { + } finally { + runAfters(test, runNotifier); + } + } } Index: MethodValidator.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/MethodValidator.java,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -u -d -r1.3.2.2 -r1.3.2.3 --- MethodValidator.java 18 Oct 2006 17:07:05 -0000 1.3.2.2 +++ MethodValidator.java 18 Oct 2006 19:36:35 -0000 1.3.2.3 @@ -1,6 +1,8 @@ package org.junit.internal.runners; import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.List; @@ -49,9 +51,31 @@ private void validateTestMethods(Class<? extends Annotation> annotation, boolean isStatic) { - List<JavaMethod> methods= fJavaClass.getMethods(annotation, new JavaTestInterpreter()); - for (JavaMethod eachMethod : methods) { - eachMethod.validateAsTestMethod(isStatic, fErrors); + for (Method eachMethod : fJavaClass.getMethods(annotation)) { + validateAsTestMethod(eachMethod, isStatic, fErrors); + } + } + + + void validateAsTestMethod(Method each, boolean isStatic, List<Throwable> errors) { + if (Modifier.isStatic(each.getModifiers()) != isStatic) { + String state= isStatic ? "should" : "should not"; + errors.add(new Exception("Method " + each.getName() + "() " + state + + " be static")); } + if (!Modifier.isPublic(each.getDeclaringClass().getModifiers())) + errors + .add(new Exception("Class " + + each.getDeclaringClass().getName() + + " should be public")); + if (!Modifier.isPublic(each.getModifiers())) + errors.add(new Exception("Method " + each.getName() + + " should be public")); + if (each.getReturnType() != Void.TYPE) + errors.add(new Exception("Method " + each.getName() + + " should be void")); + if (each.getParameterTypes().length != 0) + errors.add(new Exception("Method " + each.getName() + + " should have no parameters")); } } Index: JavaClass.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/Attic/JavaClass.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -d -r1.1.2.4 -r1.1.2.5 --- JavaClass.java 18 Oct 2006 18:22:14 -0000 1.1.2.4 +++ JavaClass.java 18 Oct 2006 19:36:35 -0000 1.1.2.5 @@ -12,6 +12,8 @@ import org.junit.AfterClass; import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.Description; public class JavaClass extends JavaModelElement { // TODO: push out @@ -33,15 +35,13 @@ return results; } - public JavaMethodList getMethods(MethodAnnotation methodAnnotation, - JavaTestInterpreter interpreter) { - JavaMethodList results= new JavaMethodList(); + public List<Method> getMethods(MethodAnnotation methodAnnotation) { + List<Method> results= new ArrayList<Method>(); for (JavaClass eachClass : getSuperClasses()) { - for (JavaMethod eachMethod : eachClass - .getDeclaredMethods(interpreter)) { + for (Method eachMethod : eachClass.getDeclaredMethods()) { Annotation annotation= eachMethod - .getAnnotation(methodAnnotation); - if (annotation != null && !eachMethod.isShadowedBy(results)) + .getAnnotation(methodAnnotation.getAnnotationClass()); + if (annotation != null && !isShadowedBy(eachMethod, results)) results.add(eachMethod); } } @@ -50,18 +50,33 @@ return results; } - private List<JavaMethod> getDeclaredMethods(JavaTestInterpreter interpreter) { - Method[] declaredMethods= fClass.getDeclaredMethods(); - ArrayList<JavaMethod> javaMethods= new ArrayList<JavaMethod>(); - for (Method method : declaredMethods) { - javaMethods.add(interpreter.interpretJavaMethod(this, method)); + private boolean isShadowedBy(Method target, Method previous) { + if (!previous.getName().equals(target.getName())) + return false; + if (previous.getParameterTypes().length != target.getParameterTypes().length) + return false; + for (int i= 0; i < previous.getParameterTypes().length; i++) { + if (!previous.getParameterTypes()[i].equals(target + .getParameterTypes()[i])) + return false; } - return javaMethods; + return true; } - public JavaMethodList getMethods(Class<? extends Annotation> type, - JavaTestInterpreter interpreter) { - return getMethods(new MethodAnnotation(type), interpreter); + boolean isShadowedBy(Method target, List<Method> results) { + for (Method each : results) { + if (isShadowedBy(target, each)) + return true; + } + return false; + } + + private Method[] getDeclaredMethods() { + return fClass.getDeclaredMethods(); + } + + public List<Method> getMethods(Class<? extends Annotation> type) { + return getMethods(new MethodAnnotation(type)); } public Class getTestClass() { @@ -103,4 +118,18 @@ public JavaClass getJavaClass() { return this; } + + public JavaMethodList getTestMethods(JavaTestInterpreter javaTestInterpreter) { + List<Method> methods= getMethods(Test.class); + JavaMethodList list= new JavaMethodList(this); + for (Method method : methods) { + list.add(javaTestInterpreter.interpretJavaMethod(this, method)); + } + return list; + } + + @Override + protected Description description() { + return Description.createSuiteDescription(fClass); + } } \ No newline at end of file Index: TestClassRunner.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/TestClassRunner.java,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -d -r1.2.2.3 -r1.2.2.4 --- TestClassRunner.java 18 Oct 2006 18:22:14 -0000 1.2.2.3 +++ TestClassRunner.java 18 Oct 2006 19:36:35 -0000 1.2.2.4 @@ -14,8 +14,6 @@ private final Class<?> fTestClass; - private JavaTestInterpreter fInterpreter; - public TestClassRunner(Class<?> klass) throws InitializationError { this(klass, new JavaTestInterpreter()); } @@ -24,7 +22,6 @@ throws InitializationError { fTestClass= klass; fEnclosedRunner= interpreter.runnerFor(klass); - fInterpreter= interpreter; } // TODO: this is parallel to passed-in runner @@ -40,10 +37,8 @@ } }; - TestEnvironment environment= new TestEnvironment(fInterpreter, - new PerTestNotifier(notifier, getDescription()), null); - environment.runWithBeforeAndAfter(protectThis, new JavaClass( - getTestClass())); + new JavaClass(getTestClass()).runWithBeforeAndAfter(protectThis, null, + notifier); } @Override --- PerTestNotifier.java DELETED --- --- TestMethodRunner.java DELETED --- |