You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(80) |
Nov
(42) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(11) |
Feb
(50) |
Mar
(70) |
Apr
(102) |
May
(28) |
Jun
(45) |
Jul
(14) |
Aug
(75) |
Sep
(17) |
Oct
(15) |
Nov
(11) |
Dec
(4) |
2003 |
Jan
(16) |
Feb
(19) |
Mar
(21) |
Apr
(20) |
May
(29) |
Jun
(7) |
Jul
(5) |
Aug
|
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(3) |
2004 |
Jan
(5) |
Feb
(4) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(1) |
Jul
(7) |
Aug
(1) |
Sep
(6) |
Oct
(6) |
Nov
(1) |
Dec
(2) |
2005 |
Jan
(4) |
Feb
(4) |
Mar
(15) |
Apr
(1) |
May
|
Jun
(4) |
Jul
(6) |
Aug
(6) |
Sep
|
Oct
(4) |
Nov
(2) |
Dec
(4) |
2006 |
Jan
|
Feb
(91) |
Mar
(47) |
Apr
(7) |
May
(4) |
Jun
(9) |
Jul
(1) |
Aug
|
Sep
(5) |
Oct
(36) |
Nov
(95) |
Dec
(12) |
2007 |
Jan
(11) |
Feb
(31) |
Mar
(45) |
Apr
(11) |
May
(9) |
Jun
(1) |
Jul
(146) |
Aug
(15) |
Sep
|
Oct
(3) |
Nov
(6) |
Dec
(1) |
2008 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(2) |
Aug
(19) |
Sep
(1) |
Oct
(10) |
Nov
|
Dec
(8) |
2009 |
Jan
(3) |
Feb
(1) |
Mar
(4) |
Apr
(8) |
May
(5) |
Jun
(4) |
Jul
(2) |
Aug
(1) |
Sep
(2) |
Oct
(13) |
Nov
(13) |
Dec
(4) |
2010 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(2) |
May
|
Jun
(1) |
Jul
(3) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2011 |
Jan
(1) |
Feb
(4) |
Mar
(3) |
Apr
(4) |
May
|
Jun
(12) |
Jul
(16) |
Aug
(4) |
Sep
(7) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
From: David S. <ds...@us...> - 2006-10-17 19:08:12
|
Update of /cvsroot/junit/junit/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18958/org/junit/internal/runners Modified Files: Tag: saff_r41_runner_refactoring TestMethodRunner.java Log Message: Remove TestIntrospector, introduce PerTestNotifier Index: TestMethodRunner.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/TestMethodRunner.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -d -r1.2 -r1.2.2.1 --- TestMethodRunner.java 15 Feb 2006 22:55:28 -0000 1.2 +++ TestMethodRunner.java 17 Oct 2006 19:08:09 -0000 1.2.2.1 @@ -1,7 +1,5 @@ package org.junit.internal.runners; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -13,38 +11,38 @@ import org.junit.Before; import org.junit.runner.Description; import org.junit.runner.notification.RunNotifier; -import org.junit.runner.notification.Failure; public class TestMethodRunner extends BeforeAndAfterRunner { private final Object fTest; - private final Method fMethod; - private final RunNotifier fNotifier; - private final TestIntrospector fTestIntrospector; - private final Description fDescription; - public TestMethodRunner(Object test, Method method, RunNotifier notifier, Description description) { - super(test.getClass(), Before.class, After.class, test); + private final JavaMethod fJavaMethod; + + private final JavaTestInterpreter fInterpreter; + + public TestMethodRunner(Object test, JavaMethod method, + RunNotifier notifier, Description description, + JavaTestInterpreter interpreter) { + super(test.getClass(), Before.class, After.class, test, + new PerTestNotifier(notifier, description)); fTest= test; - fMethod= method; - fNotifier= notifier; - fTestIntrospector= new TestIntrospector(test.getClass()); - fDescription= description; + fJavaMethod= method; + fInterpreter= interpreter; } public void run() { - if (fTestIntrospector.isIgnored(fMethod)) { - fNotifier.fireTestIgnored(fDescription); + if (fJavaMethod.isIgnored()) { + fPerTestNotifier.fireTestIgnored(); return; } - fNotifier.fireTestStarted(fDescription); + fPerTestNotifier.fireTestStarted(); try { - long timeout= fTestIntrospector.getTimeout(fMethod); + long timeout= fJavaMethod.getTimeout(); if (timeout > 0) runWithTimeout(timeout); else runMethod(); } finally { - fNotifier.fireTestFinished(fDescription); + fPerTestNotifier.fireTestFinished(); } } @@ -63,57 +61,23 @@ TimeUnit.MILLISECONDS); if (!terminated) service.shutdownNow(); - result.get(timeout, TimeUnit.MILLISECONDS); // throws the exception if one occurred during the invocation + 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))); + fPerTestNotifier.addFailure(new Exception(String.format( + "test timed out after %d milliseconds", timeout))); } catch (Exception e) { - addFailure(e); - } - } - - private void runMethod() { - runProtected(); - } - - @Override - protected void runUnprotected() { - try { - executeMethodBody(); - if (expectsException()) - addFailure(new AssertionError("Expected exception: " + expectedException().getName())); - } catch (InvocationTargetException e) { - Throwable actual= e.getTargetException(); - if (!expectsException()) - addFailure(actual); - else if (isUnexpected(actual)) { - String message= "Unexpected exception, expected<" + expectedException().getName() + "> but was<" - + actual.getClass().getName() + ">"; - addFailure(new Exception(message, actual)); - } - } catch (Throwable e) { - addFailure(e); + fPerTestNotifier.addFailure(e); } } - protected void executeMethodBody() throws IllegalAccessException, InvocationTargetException { - fMethod.invoke(fTest); + private void runMethod() { + runProtected(); } @Override - protected void addFailure(Throwable e) { - fNotifier.fireTestFailure(new Failure(fDescription, e)); - } - - private boolean expectsException() { - return expectedException() != null; - } - - private Class<? extends Throwable> expectedException() { - return fTestIntrospector.expectedException(fMethod); - } - - private boolean isUnexpected(Throwable exception) { - return ! expectedException().isAssignableFrom(exception.getClass()); + protected void runUnprotected() { + fJavaMethod.runUnprotected(fInterpreter, fTest, fPerTestNotifier); } } - |
From: David S. <ds...@us...> - 2006-10-17 19:07:45
|
Update of /cvsroot/junit/junit/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18576/org/junit/internal/runners Modified Files: Tag: saff_r41_runner_refactoring TestClassRunner.java Log Message: Remove TestIntrospector Index: TestClassRunner.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/TestClassRunner.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -d -r1.2 -r1.2.2.1 --- TestClassRunner.java 15 Feb 2006 22:55:28 -0000 1.2 +++ TestClassRunner.java 17 Oct 2006 19:07:40 -0000 1.2.2.1 @@ -10,17 +10,22 @@ import org.junit.runner.manipulation.Sortable; import org.junit.runner.manipulation.Sorter; import org.junit.runner.notification.RunNotifier; -import org.junit.runner.notification.Failure; public class TestClassRunner extends Runner implements Filterable, Sortable { protected final Runner fEnclosedRunner; - private final Class<?> fTestClass; + private final Class<?> fTestClass; + public TestClassRunner(Class<?> klass) throws InitializationError { - this(klass, new TestClassMethodsRunner(klass)); + this(klass, new JavaTestInterpreter()); } - public TestClassRunner(Class<?> klass, Runner runner) throws InitializationError { + public TestClassRunner(Class<?> klass, JavaTestInterpreter interpreter) throws InitializationError { + this(klass, new TestClassMethodsRunner(new JavaClass(klass), interpreter)); + } + + public TestClassRunner(Class<?> klass, Runner runner) + throws InitializationError { fTestClass= klass; fEnclosedRunner= runner; MethodValidator methodValidator= new MethodValidator(klass); @@ -35,18 +40,13 @@ @Override public void run(final RunNotifier notifier) { - BeforeAndAfterRunner runner = new BeforeAndAfterRunner(getTestClass(), - BeforeClass.class, AfterClass.class, null) { + BeforeAndAfterRunner runner= new BeforeAndAfterRunner(getTestClass(), + BeforeClass.class, AfterClass.class, null, new PerTestNotifier(notifier, + getDescription())) { @Override protected void runUnprotected() { fEnclosedRunner.run(notifier); } - - // TODO: looks very similar to other method of BeforeAfter, now - @Override - protected void addFailure(Throwable targetException) { - notifier.fireTestFailure(new Failure(getDescription(), targetException)); - } }; runner.runProtected(); @@ -56,9 +56,9 @@ public Description getDescription() { return fEnclosedRunner.getDescription(); } - + // TODO: good behavior when createTest fails - + // TODO: dup? public void filter(Filter filter) throws NoTestsRemainException { filter.apply(fEnclosedRunner); |
From: David S. <ds...@us...> - 2006-10-17 19:07:13
|
Update of /cvsroot/junit/junit/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18524/org/junit/internal/runners Modified Files: Tag: saff_r41_runner_refactoring TestClassMethodsRunner.java Log Message: More extensive use of JavaMethod instead of Method Index: TestClassMethodsRunner.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/TestClassMethodsRunner.java,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -u -d -r1.3.2.1 -r1.3.2.2 --- TestClassMethodsRunner.java 26 Sep 2006 16:51:39 -0000 1.3.2.1 +++ TestClassMethodsRunner.java 17 Oct 2006 19:07:09 -0000 1.3.2.2 @@ -19,20 +19,26 @@ import org.junit.runner.notification.RunNotifier; public class TestClassMethodsRunner extends Runner implements Filterable, Sortable { - private final List<Method> fTestMethods; - private final Class<?> fTestClass; + private final List<JavaMethod> fTestMethods; + private final JavaClass fTestClass; + private final JavaTestInterpreter fInterpreter; // This assumes that some containing runner will perform validation of the test methods - public TestClassMethodsRunner(Class<?> klass) { + public TestClassMethodsRunner(JavaClass klass, JavaTestInterpreter javaTestInterpreter) { + + // TODO: DUP? fTestClass= klass; - fTestMethods= new JavaClass(klass).getTestMethods(Test.class); + fTestMethods= klass.getTestMethods(Test.class); + fInterpreter= javaTestInterpreter; } + // TODO: rename method to element? + @Override public void run(RunNotifier notifier) { if (fTestMethods.isEmpty()) testAborted(notifier, getDescription(), new Exception("No runnable methods")); - for (Method method : fTestMethods) + for (JavaMethod method : fTestMethods) invokeTestMethod(method, notifier); } @@ -47,21 +53,24 @@ @Override public Description getDescription() { Description spec= Description.createSuiteDescription(getName()); - List<Method> testMethods= fTestMethods; - for (Method method : testMethods) + for (JavaMethod method : fTestMethods) spec.addChild(methodDescription(method)); return spec; } + protected Description methodDescription(Method method) { + return methodDescription(new JavaMethod(method)); + } + protected String getName() { return getTestClass().getName(); } protected Object createTest() throws Exception { - return getTestClass().getConstructor().newInstance(); + return getTestClass().newTestObject(); } - protected void invokeTestMethod(Method method, RunNotifier notifier) { + private void invokeTestMethod(JavaMethod method, RunNotifier notifier) { Object test; try { test= createTest(); @@ -75,21 +84,25 @@ createMethodRunner(test, method, notifier).run(); } - protected TestMethodRunner createMethodRunner(Object test, Method method, RunNotifier notifier) { - return new TestMethodRunner(test, method, notifier, methodDescription(method)); + private TestMethodRunner createMethodRunner(Object test, JavaMethod method, RunNotifier notifier) { + return new TestMethodRunner(test, method, notifier, methodDescription(method), fInterpreter); } - protected String testName(Method method) { + protected String testName(JavaModelElement method) { return method.getName(); } - protected Description methodDescription(Method method) { - return Description.createTestDescription(getTestClass(), testName(method)); + private Description methodDescription(JavaMethod method) { + return describe(method, getTestClass()); + } + + private Description describe(JavaMethod method, JavaClass testClass) { + return Description.createTestDescription(testClass.getTestClass(), testName(method)); } public void filter(Filter filter) throws NoTestsRemainException { - for (Iterator iter= fTestMethods.iterator(); iter.hasNext();) { - Method method= (Method) iter.next(); + for (Iterator<JavaMethod> iter= fTestMethods.iterator(); iter.hasNext();) { + JavaMethod method= iter.next(); if (!filter.shouldRun(methodDescription(method))) iter.remove(); } @@ -98,14 +111,14 @@ } public void sort(final Sorter sorter) { - Collections.sort(fTestMethods, new Comparator<Method>() { - public int compare(Method o1, Method o2) { + Collections.sort(fTestMethods, new Comparator<JavaMethod>() { + public int compare(JavaMethod o1, JavaMethod o2) { return sorter.compare(methodDescription(o1), methodDescription(o2)); } }); } - protected Class<?> getTestClass() { + protected JavaClass getTestClass() { return fTestClass; } } \ No newline at end of file |
From: David S. <ds...@us...> - 2006-10-17 19:06:36
|
Update of /cvsroot/junit/junit/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18125/org/junit/internal/runners Modified Files: Tag: saff_r41_runner_refactoring MethodValidator.java Log Message: Remove TestIntrospector Index: MethodValidator.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/MethodValidator.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -d -r1.3 -r1.3.2.1 --- MethodValidator.java 28 Jun 2006 20:55:36 -0000 1.3 +++ MethodValidator.java 17 Oct 2006 19:06:32 -0000 1.3.2.1 @@ -1,8 +1,6 @@ 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; @@ -13,15 +11,12 @@ import org.junit.Test; public class MethodValidator { - private final TestIntrospector fIntrospector; - private final List<Throwable> fErrors= new ArrayList<Throwable>(); - private final Class<?> fTestClass; + private final JavaClass fJavaClass; public MethodValidator(Class<?> testClass) { - fTestClass= testClass; - fIntrospector= new TestIntrospector(testClass); + fJavaClass= new JavaClass(testClass); } public void validateInstanceMethods() { @@ -49,34 +44,14 @@ } public void validateNoArgConstructor() { - try { - fTestClass.getConstructor(); - } catch (Exception e) { - fErrors.add(new Exception("Test class should have public zero-argument constructor", e)); - } + fJavaClass.validateNoArgConstructor(fErrors); } private void validateTestMethods(Class<? extends Annotation> annotation, boolean isStatic) { - List<Method> methods= fIntrospector.getTestMethods(annotation); - for (Method each : methods) { - if (Modifier.isStatic(each.getModifiers()) != isStatic) { - String state= isStatic ? "should" : "should not"; - fErrors.add(new Exception("Method " + each.getName() + "() " - + state + " be static")); - } - if (!Modifier.isPublic(each.getDeclaringClass().getModifiers())) - fErrors.add(new Exception("Class " + each.getDeclaringClass().getName() - + " should be public")); - if (!Modifier.isPublic(each.getModifiers())) - fErrors.add(new Exception("Method " + each.getName() - + " should be public")); - if (each.getReturnType() != Void.TYPE) - fErrors.add(new Exception("Method " + each.getName() - + " should be void")); - if (each.getParameterTypes().length != 0) - fErrors.add(new Exception("Method " + each.getName() - + " should have no parameters")); + List<JavaMethod> methods= fJavaClass.getTestMethods(annotation); + for (JavaMethod eachMethod : methods) { + eachMethod.validateAsTestMethod(isStatic, fErrors); } } } |
From: David S. <ds...@us...> - 2006-10-17 19:06:12
|
Update of /cvsroot/junit/junit/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18074/org/junit/internal/runners Modified Files: Tag: saff_r41_runner_refactoring JavaMethod.java JavaClass.java Added Files: Tag: saff_r41_runner_refactoring JavaModelElement.java Log Message: Introduce JavaModelElement (this may eventually get rid of BeforeAndAfterRunner, but I'm not sure yet) --- NEW FILE: JavaModelElement.java --- package org.junit.internal.runners; public abstract class JavaModelElement { public abstract String getName(); } Index: JavaMethod.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/Attic/JavaMethod.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 --- JavaMethod.java 26 Sep 2006 16:51:39 -0000 1.1.2.1 +++ JavaMethod.java 17 Oct 2006 19:06:09 -0000 1.1.2.2 @@ -4,18 +4,25 @@ package org.junit.internal.runners; import java.lang.annotation.Annotation; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.lang.reflect.Modifier; import java.util.List; -class JavaMethod { +import org.junit.Ignore; +import org.junit.Test; +import org.junit.Test.None; + +public class JavaMethod extends JavaModelElement { // TODO: push out private final Method fMethod; - JavaMethod(Method current) { + public JavaMethod(Method current) { fMethod= current; } - public boolean isShadowedBy(Method previous) { + private boolean isShadowedBy(JavaMethod previousJavaMethod) { + Method previous= previousJavaMethod.fMethod; if (!previous.getName().equals(fMethod.getName())) return false; if (previous.getParameterTypes().length != fMethod @@ -29,8 +36,8 @@ return true; } - boolean isShadowedBy(List<Method> results) { - for (Method each : results) { + boolean isShadowedBy(List<JavaMethod> results) { + for (JavaMethod each : results) { if (isShadowedBy(each)) return true; } @@ -41,7 +48,84 @@ return fMethod.getAnnotation(methodAnnotation.getAnnotationClass()); } - public Method getMethod() { - return fMethod; + boolean isIgnored() { + return fMethod.getAnnotation(Ignore.class) != null; + } + + long getTimeout() { + return getTestAnnotation().timeout(); + } + + private Test getTestAnnotation() { + return fMethod.getAnnotation(Test.class); + } + + Class<? extends Throwable> expectedException() { + Test annotation= getTestAnnotation(); + if (annotation.expected() == None.class) + return null; + else + return annotation.expected(); + } + + boolean isUnexpected(Throwable exception) { + return ! expectedException().isAssignableFrom(exception.getClass()); + } + + boolean expectsException() { + return expectedException() != null; + } + + void invoke(Object object) throws IllegalAccessException, + InvocationTargetException { + fMethod.invoke(object); + } + + @Override + public String getName() { + 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")); + } + + void runUnprotected(JavaTestInterpreter javaTestInterpreter, Object test, PerTestNotifier perTestNotifier) { + try { + javaTestInterpreter.executeMethodBody(test, this); + if (expectsException()) + perTestNotifier.addFailure(new AssertionError( + "Expected exception: " + + expectedException().getName())); + } catch (InvocationTargetException e) { + Throwable actual= e.getTargetException(); + if (!expectsException()) + perTestNotifier.addFailure(actual); + else if (isUnexpected(actual)) { + String message= "Unexpected exception, expected<" + + expectedException().getName() + + "> but was<" + actual.getClass().getName() + ">"; + perTestNotifier.addFailure(new Exception(message, actual)); + } + } catch (Throwable e) { + perTestNotifier.addFailure(e); + } } } \ No newline at end of file Index: JavaClass.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/Attic/JavaClass.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 --- JavaClass.java 26 Sep 2006 16:51:39 -0000 1.1.2.1 +++ JavaClass.java 17 Oct 2006 19:06:09 -0000 1.1.2.2 @@ -4,16 +4,17 @@ package org.junit.internal.runners; import java.lang.annotation.Annotation; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; import java.util.List; -class JavaClass { +public class JavaClass extends JavaModelElement { // TODO: push out private final Class<?> fClass; - JavaClass(Class<?> type) { + public JavaClass(Class<?> type) { fClass= type; } @@ -27,14 +28,13 @@ return results; } - List<Method> getTestMethods(MethodAnnotation methodAnnotation) { - List<Method> results= new ArrayList<Method>(); + List<JavaMethod> getTestMethods(MethodAnnotation methodAnnotation) { + List<JavaMethod> results= new ArrayList<JavaMethod>(); for (JavaClass eachClass : getSuperClasses()) { - List<JavaMethod> methods= eachClass.getDeclaredMethods(); - for (JavaMethod eachMethod : methods) { + for (JavaMethod eachMethod : eachClass.getDeclaredMethods()) { Annotation annotation= eachMethod.getAnnotation(methodAnnotation); if (annotation != null && ! eachMethod.isShadowedBy(results)) - results.add(eachMethod.getMethod()); + results.add(eachMethod); } } if (methodAnnotation.runsTopToBottom()) @@ -51,7 +51,30 @@ return javaMethods; } - List<Method> getTestMethods(Class<? extends Annotation> type) { + List<JavaMethod> getTestMethods(Class<? extends Annotation> type) { return getTestMethods(new MethodAnnotation(type)); } + + public Class getTestClass() { + return fClass; + } + + void validateNoArgConstructor(List<Throwable> errors) { + try { + getTestClass().getConstructor(); + } catch (Exception e) { + errors.add(new Exception("Test class should have public zero-argument constructor", e)); + } + } + + @Override + public String getName() { + return fClass.getName(); + } + + Object newTestObject() + throws InstantiationException, IllegalAccessException, + InvocationTargetException, NoSuchMethodException { + return getTestClass().getConstructor().newInstance(); + } } \ No newline at end of file |
From: David S. <ds...@us...> - 2006-10-17 19:03:56
|
Update of /cvsroot/junit/junit/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16932/org/junit/internal/runners Modified Files: Tag: saff_r41_runner_refactoring BeforeAndAfterRunner.java Added Files: Tag: saff_r41_runner_refactoring PerTestNotifier.java Removed Files: Tag: saff_r41_runner_refactoring TestIntrospector.java Log Message: Remove TestIntrospector, introduce PerTestNotifier --- NEW FILE: PerTestNotifier.java --- package org.junit.internal.runners; import org.junit.runner.Description; import org.junit.runner.notification.Failure; import org.junit.runner.notification.RunNotifier; public class PerTestNotifier { // TODO: push out private final RunNotifier fNotifier; private final Description fDescription; public PerTestNotifier(RunNotifier notifier, Description description) { fNotifier= notifier; fDescription= description; } public void addFailure(Throwable targetException) { fNotifier.fireTestFailure(new Failure(fDescription, targetException)); } public void fireTestIgnored() { fNotifier.fireTestIgnored(fDescription); } public void fireTestFinished() { fNotifier.fireTestFinished(fDescription); } public void fireTestStarted() { fNotifier.fireTestStarted(fDescription); } } Index: BeforeAndAfterRunner.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/BeforeAndAfterRunner.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -d -r1.2 -r1.2.2.1 --- BeforeAndAfterRunner.java 15 Feb 2006 22:55:28 -0000 1.2 +++ BeforeAndAfterRunner.java 17 Oct 2006 19:03:52 -0000 1.2.2.1 @@ -2,7 +2,6 @@ import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.List; public abstract class BeforeAndAfterRunner { @@ -14,18 +13,21 @@ private final Class<? extends Annotation> fAfterAnnotation; - private TestIntrospector fTestIntrospector; - private Object fTest; + private final JavaClass fJavaClass; + + protected PerTestNotifier fPerTestNotifier; + public BeforeAndAfterRunner(Class<?> testClass, Class<? extends Annotation> beforeAnnotation, - Class<? extends Annotation> afterAnnotation, - Object test) { + Class<? extends Annotation> afterAnnotation, Object test, + PerTestNotifier perTestNotifier) { fBeforeAnnotation= beforeAnnotation; fAfterAnnotation= afterAnnotation; - fTestIntrospector= new TestIntrospector(testClass); fTest= test; + fPerTestNotifier= perTestNotifier; + fJavaClass= new JavaClass(testClass); } public void runProtected() { @@ -40,37 +42,36 @@ protected abstract void runUnprotected(); - protected abstract void addFailure(Throwable targetException); - // Stop after first failed @Before private void runBefores() throws FailedBefore { try { - List<Method> befores= fTestIntrospector.getTestMethods(fBeforeAnnotation); - for (Method before : befores) - invokeMethod(before); + List<JavaMethod> befores= fJavaClass + .getTestMethods(fBeforeAnnotation); + + // TODO: no auto-correct if wrong type on left side of new-style + // for? + for (JavaMethod before : befores) + before.invoke(fTest); } catch (InvocationTargetException e) { - addFailure(e.getTargetException()); + fPerTestNotifier.addFailure(e.getTargetException()); throw new FailedBefore(); } catch (Throwable e) { - addFailure(e); + fPerTestNotifier.addFailure(e); throw new FailedBefore(); } } // Try to run all @Afters regardless private void runAfters() { - List<Method> afters= fTestIntrospector.getTestMethods(fAfterAnnotation); - for (Method after : afters) + List<JavaMethod> afters= fJavaClass.getTestMethods(fAfterAnnotation); + for (JavaMethod after : afters) try { - invokeMethod(after); + after.invoke(fTest); } catch (InvocationTargetException e) { - addFailure(e.getTargetException()); + fPerTestNotifier.addFailure(e.getTargetException()); } catch (Throwable e) { - addFailure(e); // Untested, but seems impossible + fPerTestNotifier.addFailure(e); // Untested, but seems + // impossible } } - - private void invokeMethod(Method method) throws Exception { - method.invoke(fTest); - } } --- TestIntrospector.java DELETED --- |
From: David S. <ds...@us...> - 2006-10-17 19:01:10
|
Update of /cvsroot/junit/junit/org/junit/internal/requests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15727/org/junit/internal/requests Modified Files: Tag: saff_r41_runner_refactoring ClassRequest.java Log Message: InterpretWith allows a delegation-style, rather than inheritance-style, extension mechanism Index: ClassRequest.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/requests/ClassRequest.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -d -r1.3 -r1.3.2.1 --- ClassRequest.java 25 Aug 2006 14:37:09 -0000 1.3 +++ ClassRequest.java 17 Oct 2006 19:00:57 -0000 1.3.2.1 @@ -7,6 +7,7 @@ import org.junit.runner.Request; import org.junit.runner.RunWith; import org.junit.runner.Runner; +import org.junit.tests.InterpretWith; public class ClassRequest extends Request { private final Class<?> fTestClass; @@ -17,9 +18,15 @@ @Override public Runner getRunner() { - Class runnerClass= getRunnerClass(fTestClass); try { - Constructor constructor= runnerClass.getConstructor(Class.class); // TODO good error message if no such constructor + InterpretWith annotation = fTestClass.getAnnotation(InterpretWith.class); + if (annotation != null) + return new TestClassRunner(fTestClass, annotation.value().newInstance()); + + Class runnerClass= getRunnerClass(fTestClass); + + // TODO good error message if no such constructor + Constructor constructor= runnerClass.getConstructor(Class.class); Runner runner= (Runner) constructor .newInstance(new Object[] { fTestClass }); return runner; |
From: David S. <ds...@us...> - 2006-10-17 19:01:08
|
Update of /cvsroot/junit/junit/org/junit/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15727/org/junit/tests Added Files: Tag: saff_r41_runner_refactoring InterpretWith.java Log Message: InterpretWith allows a delegation-style, rather than inheritance-style, extension mechanism --- NEW FILE: InterpretWith.java --- package org.junit.tests; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.junit.internal.runners.JavaTestInterpreter; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @Inherited public @interface InterpretWith { Class<? extends JavaTestInterpreter> value(); } |
From: David S. <ds...@us...> - 2006-10-17 19:01:05
|
Update of /cvsroot/junit/junit/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15727/org/junit/internal/runners Added Files: Tag: saff_r41_runner_refactoring JavaTestInterpreter.java Log Message: InterpretWith allows a delegation-style, rather than inheritance-style, extension mechanism --- NEW FILE: JavaTestInterpreter.java --- package org.junit.internal.runners; import java.lang.reflect.InvocationTargetException; public class JavaTestInterpreter { // TODO: push out /* (non-Javadoc) * @see org.junit.internal.runners.IJavaTestInterpreter#executeMethodBody(java.lang.Object, org.junit.internal.runners.JavaMethod) */ public void executeMethodBody(Object test, JavaMethod javaMethod) throws IllegalAccessException, InvocationTargetException { javaMethod.invoke(test); } } |
From: Jochen H. <jo....@go...> - 2006-10-02 22:56:24
|
Hi all, Note: I moved the discussion from feature request "1447312" (https://sourceforge.net/tracker/?func=detail&aid=1447312&group_id=15278&ati d=365278) to dev mailing list, as agreed by David Saff. Background: =========== Test cases can be dependent on prerequisites, e.g. be online in Internet, have a database available, have database filled with specific test data, etc. In these cases it can be very annoying to change always the "@Ignore" behaviour of test cases, because it may be different for each run or development time. A "@Prerequisite" annotation may support a dynamic evaluation of specified prerequisites. Each test case marked with @Prerequisite will be checked, whether the condition is fulfilled. If not, the test case will be marked as ignored. For example: @Prerequisite (requires="isDBAvailable") @Test public void doDBTest() { ... } The method isDBAvailable() must be implemented with following signature: - must be callable from TestRunner, so must be public. - must be callable either from tested object, or from a static helper class. - must return a boolean value. For example: public boolean isDBAvailable() { boolean available = ...; return available; } This method can also be provided by a static helper class, when specifiying a callee attribute to annotation. For example: @Prerequisite (requires="isDBAvailable", callee=DBHelper.class) @Test public void doDBTest() { ... } public class DBHelper { public static boolean isDBAvailable() { boolean available = ...; return available; } } Design questions: ================= 1. The Filter class allows to implement shouldRun(Description desc), where Description contains metadata about the current test (isSuite, isTest, hasChildren, and a display name). But, there is no access to the Java method for any reflection call. This is required, if the implementation has to know about the existence of an own annotation for the current test method. A very ugly solution is, to parse the current test class and test method based on the display name :( 2. When calling the shouldRun(Description desc) method, there is no access available to current test object. So, if we want to call the instance method of the prerequisite (e.g. isDBavailable()), we do NOT have access in filter. A workaround has been, to implement an AnnotationRunner, which checks for known annotations, and call specific callbacks (e.g. using the current test object). Additionally we have to specify @RunWith(AnnotationsRunner.class) to use this specific runner for the test class. I think, the current implementation of Filter/Filterable does not support Annotations very well. Can someone help with other implementation approaches, or do we have to redesign the current implementation ? Comments welcome. Bye, Jochen My current implementation is available at http://www.junitext.org. See also: - First feature request for @Prerequisite. Moved discussion now to dev-mailing list https://sourceforge.net/tracker/?func=detail&aid=1447312&group_id=15278&at id=365278 - feature request: "Description does not allow access to metadata via reflection" https://sourceforge.net/tracker/index.php?func=detail&aid=1569263&group_id =15278&atid=365278 - feature request: "Filter / Sorter do NOT have access to current test object" https://sourceforge.net/tracker/index.php?func=detail&aid=1569265&group_id =15278&atid=365278 |
Update of /cvsroot/junit/junit/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6170/org/junit/internal/runners Modified Files: Tag: saff_r41_runner_refactoring TestIntrospector.java TestClassMethodsRunner.java Added Files: Tag: saff_r41_runner_refactoring JavaMethod.java JavaClass.java MethodAnnotation.java Log Message: Begin pushing functionality out of operator classes (like TestIntrospector) and into domain classes (like JavaClass) --- NEW FILE: JavaMethod.java --- /** * */ package org.junit.internal.runners; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.List; class JavaMethod { // TODO: push out private final Method fMethod; JavaMethod(Method current) { fMethod= current; } public boolean isShadowedBy(Method previous) { 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<Method> results) { for (Method each : results) { if (isShadowedBy(each)) return true; } return false; } public Annotation getAnnotation(MethodAnnotation methodAnnotation) { return fMethod.getAnnotation(methodAnnotation.getAnnotationClass()); } public Method getMethod() { return fMethod; } } --- NEW FILE: JavaClass.java --- /** * */ package org.junit.internal.runners; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; import java.util.List; class JavaClass { // TODO: push out private final Class<?> fClass; JavaClass(Class<?> type) { fClass= type; } public List<JavaClass> getSuperClasses() { ArrayList<JavaClass> results= new ArrayList<JavaClass>(); Class<?> current= fClass; while (current != null) { results.add(new JavaClass(current)); current= current.getSuperclass(); } return results; } List<Method> getTestMethods(MethodAnnotation methodAnnotation) { List<Method> results= new ArrayList<Method>(); for (JavaClass eachClass : getSuperClasses()) { List<JavaMethod> methods= eachClass.getDeclaredMethods(); for (JavaMethod eachMethod : methods) { Annotation annotation= eachMethod.getAnnotation(methodAnnotation); if (annotation != null && ! eachMethod.isShadowedBy(results)) results.add(eachMethod.getMethod()); } } if (methodAnnotation.runsTopToBottom()) Collections.reverse(results); return results; } private List<JavaMethod> getDeclaredMethods() { Method[] declaredMethods= fClass.getDeclaredMethods(); ArrayList<JavaMethod> javaMethods= new ArrayList<JavaMethod>(); for (Method method : declaredMethods) { javaMethods.add(new JavaMethod(method)); } return javaMethods; } List<Method> getTestMethods(Class<? extends Annotation> type) { return getTestMethods(new MethodAnnotation(type)); } } --- NEW FILE: MethodAnnotation.java --- /** * */ package org.junit.internal.runners; import java.lang.annotation.Annotation; import org.junit.RunSuperclassMethodsFirst; final class MethodAnnotation { // TODO: push out // TODO: package too big? private final Class<? extends Annotation> fAnnotation; MethodAnnotation(Class<? extends Annotation> annotation) { fAnnotation= annotation; } public boolean runsTopToBottom() { return fAnnotation.getAnnotation(RunSuperclassMethodsFirst.class) != null; } public Class<? extends Annotation> getAnnotationClass() { return fAnnotation; } } Index: TestIntrospector.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/TestIntrospector.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -d -r1.3 -r1.3.2.1 --- TestIntrospector.java 27 Apr 2006 22:11:51 -0000 1.3 +++ TestIntrospector.java 26 Sep 2006 16:51:39 -0000 1.3.2.1 @@ -2,12 +2,8 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.junit.Test.None; @@ -21,56 +17,19 @@ } public List<Method> getTestMethods(Class<? extends Annotation> annotationClass) { - List<Method> results= new ArrayList<Method>(); - for (Class eachClass : getSuperClasses(fTestClass)) { - Method[] methods= eachClass.getDeclaredMethods(); - for (Method eachMethod : methods) { - Annotation annotation= eachMethod.getAnnotation(annotationClass); - if (annotation != null && ! isShadowed(eachMethod, results)) - results.add(eachMethod); - } - } - if (runsTopToBottom(annotationClass)) - Collections.reverse(results); - return results; - } - - public boolean isIgnored(Method eachMethod) { - return eachMethod.getAnnotation(Ignore.class) != null; + return getJavaClass().getTestMethods(new MethodAnnotation(annotationClass)); } - private boolean runsTopToBottom(Class< ? extends Annotation> annotation) { - return annotation.equals(Before.class) || annotation.equals(BeforeClass.class); - } - - private boolean isShadowed(Method method, List<Method> results) { - for (Method each : results) { - if (isShadowed(method, each)) - return true; - } - return false; + JavaClass getJavaClass() { + return new JavaClass(getTestClass()); } - private boolean isShadowed(Method current, Method previous) { - if (! previous.getName().equals(current.getName())) - return false; - if (previous.getParameterTypes().length != current.getParameterTypes().length) - return false; - for (int i= 0; i < previous.getParameterTypes().length; i++) { - if (! previous.getParameterTypes()[i].equals(current.getParameterTypes()[i])) - return false; - } - return true; + public Class<?> getTestClass() { + return fTestClass; } - private List<Class> getSuperClasses(Class< ?> testClass) { - ArrayList<Class> results= new ArrayList<Class>(); - Class<?> current= testClass; - while (current != null) { - results.add(current); - current= current.getSuperclass(); - } - return results; + public boolean isIgnored(Method eachMethod) { + return eachMethod.getAnnotation(Ignore.class) != null; } long getTimeout(Method method) { Index: TestClassMethodsRunner.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/TestClassMethodsRunner.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -d -r1.3 -r1.3.2.1 --- TestClassMethodsRunner.java 3 Aug 2006 22:03:01 -0000 1.3 +++ TestClassMethodsRunner.java 26 Sep 2006 16:51:39 -0000 1.3.2.1 @@ -25,9 +25,9 @@ // This assumes that some containing runner will perform validation of the test methods public TestClassMethodsRunner(Class<?> klass) { fTestClass= klass; - fTestMethods= new TestIntrospector(getTestClass()).getTestMethods(Test.class); + fTestMethods= new JavaClass(klass).getTestMethods(Test.class); } - + @Override public void run(RunNotifier notifier) { if (fTestMethods.isEmpty()) |
From: David S. <ds...@us...> - 2006-09-26 16:51:44
|
Update of /cvsroot/junit/junit/junit/framework In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6170/junit/framework Modified Files: Tag: saff_r41_runner_refactoring TestSuite.java Log Message: Begin pushing functionality out of operator classes (like TestIntrospector) and into domain classes (like JavaClass) Index: TestSuite.java =================================================================== RCS file: /cvsroot/junit/junit/junit/framework/TestSuite.java,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -u -d -r1.17 -r1.17.2.1 --- TestSuite.java 25 Aug 2006 14:43:02 -0000 1.17 +++ TestSuite.java 26 Sep 2006 16:51:39 -0000 1.17.2.1 @@ -171,7 +171,7 @@ * Constructs a TestSuite from the given array of classes. * @param classes {@link TestCase}s */ - public TestSuite (Class<? extends TestCase>... classes) { + public TestSuite (Class... classes) { for (Class<? extends TestCase> each : classes) addTest(new TestSuite(each)); } |
From: David S. <ds...@us...> - 2006-09-26 16:51:44
|
Update of /cvsroot/junit/junit/org/junit In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6170/org/junit Modified Files: Tag: saff_r41_runner_refactoring Before.java BeforeClass.java Added Files: Tag: saff_r41_runner_refactoring RunSuperclassMethodsFirst.java Log Message: Begin pushing functionality out of operator classes (like TestIntrospector) and into domain classes (like JavaClass) --- NEW FILE: RunSuperclassMethodsFirst.java --- package org.junit; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.ANNOTATION_TYPE) public @interface RunSuperclassMethodsFirst { } Index: Before.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/Before.java,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -d -r1.4 -r1.4.2.1 --- Before.java 25 Aug 2006 14:43:02 -0000 1.4 +++ Before.java 26 Sep 2006 16:51:39 -0000 1.4.2.1 @@ -32,6 +32,7 @@ */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) +@RunSuperclassMethodsFirst public @interface Before { } Index: BeforeClass.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/BeforeClass.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -d -r1.3 -r1.3.2.1 --- BeforeClass.java 25 Aug 2006 14:43:02 -0000 1.3 +++ BeforeClass.java 26 Sep 2006 16:51:39 -0000 1.3.2.1 @@ -31,5 +31,6 @@ */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) +@RunSuperclassMethodsFirst public @interface BeforeClass { } |
From: David S. <ds...@us...> - 2006-09-26 16:51:44
|
Update of /cvsroot/junit/junit In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6170 Modified Files: Tag: saff_r41_runner_refactoring .classpath Log Message: Begin pushing functionality out of operator classes (like TestIntrospector) and into domain classes (like JavaClass) Index: .classpath =================================================================== RCS file: /cvsroot/junit/junit/.classpath,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -d -r1.5 -r1.5.2.1 --- .classpath 25 Aug 2006 14:43:03 -0000 1.5 +++ .classpath 26 Sep 2006 16:51:39 -0000 1.5.2.1 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry excluding="bin/|doc/|junit4.0*/**|junit4.1*/**" kind="src" path=""/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.5.0_07"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> </classpath> |
From: Eric L. B. <eb...@bo...> - 2006-09-26 10:33:48
|
It would be nice if TestClassMethodsRunner.invokeTestMethod() logged the exception it catches from a call to createTest(). A lot of things might fail assembling an instance of the test class. cheers, Eric |
From: Trapa, V. \(Valerie\) <vt...@av...> - 2006-07-14 21:41:04
|
T3 tool is a lightweight framework based on JUnit that provides visibility into project progress to support rapid development. Using story-centric views, Agile teams can quickly assess status, determine dependencies and identify pain-points. =20 T3 is available at http://home.comcast.net/~software-without-borders=20 Would it be possible to add this link to www.junit.org <http://www.junit.org/> ? =20 Thanks, Valerie |
From: David S. <ds...@us...> - 2006-06-29 12:43:26
|
Update of /cvsroot/junit/junit/org/junit/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31336/org/junit/tests Modified Files: AllTests.java Log Message: Someone doesn't like commas at the end of annotation lists Index: AllTests.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/tests/AllTests.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- AllTests.java 28 Jun 2006 20:55:36 -0000 1.4 +++ AllTests.java 29 Jun 2006 12:43:22 -0000 1.5 @@ -38,7 +38,7 @@ SortableTest.class, OldTestClassRunnerTest.class, JUnitCoreTest.class, - InaccessibleBaseClassTest.class, + InaccessibleBaseClassTest.class }) public class AllTests { // public static class Compatibility { |
From: David S. <ds...@us...> - 2006-06-28 20:55:42
|
Update of /cvsroot/junit/junit/org/junit/tests In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20424/org/junit/tests Modified Files: AllTests.java Added Files: InaccessibleBaseClassTest.java Log Message: Methods on inaccessible superclasses of test classes are caught during validation --- NEW FILE: InaccessibleBaseClassTest.java --- package org.junit.tests; import org.junit.Test; import org.junit.internal.runners.InitializationError; import org.junit.internal.runners.MethodValidator; 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.validateAllMethods(); methodValidator.assertValid(); } } Index: AllTests.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/tests/AllTests.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- AllTests.java 17 Feb 2006 21:38:10 -0000 1.3 +++ AllTests.java 28 Jun 2006 20:55:36 -0000 1.4 @@ -37,7 +37,8 @@ UserStopTest.class, SortableTest.class, OldTestClassRunnerTest.class, - JUnitCoreTest.class + JUnitCoreTest.class, + InaccessibleBaseClassTest.class, }) public class AllTests { // public static class Compatibility { |
From: David S. <ds...@us...> - 2006-06-28 20:55:40
|
Update of /cvsroot/junit/junit/org/junit/tests/anotherpackage In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20424/org/junit/tests/anotherpackage Added Files: Sub.java Super.java Log Message: Methods on inaccessible superclasses of test classes are caught during validation --- NEW FILE: Sub.java --- package org.junit.tests.anotherpackage; public class Sub extends Super { } --- NEW FILE: Super.java --- package org.junit.tests.anotherpackage; import org.junit.Test; class Super { @Test public void a() {} } |
From: David S. <ds...@us...> - 2006-06-28 20:55:39
|
Update of /cvsroot/junit/junit/org/junit/internal/runners In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20424/org/junit/internal/runners Modified Files: MethodValidator.java Log Message: Methods on inaccessible superclasses of test classes are caught during validation Index: MethodValidator.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/internal/runners/MethodValidator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- MethodValidator.java 15 Feb 2006 22:55:28 -0000 1.2 +++ MethodValidator.java 28 Jun 2006 20:55:36 -0000 1.3 @@ -35,6 +35,7 @@ validateTestMethods(AfterClass.class, true); } + // TODO Ugly API--one method should do both public List<Throwable> validateAllMethods() { validateNoArgConstructor(); validateStaticMethods(); @@ -64,6 +65,9 @@ fErrors.add(new Exception("Method " + each.getName() + "() " + state + " be static")); } + if (!Modifier.isPublic(each.getDeclaringClass().getModifiers())) + fErrors.add(new Exception("Class " + each.getDeclaringClass().getName() + + " should be public")); if (!Modifier.isPublic(each.getModifiers())) fErrors.add(new Exception("Method " + each.getName() + " should be public")); |
From: David S. <ds...@us...> - 2006-06-28 20:55:34
|
Update of /cvsroot/junit/junit/org/junit/tests/anotherpackage In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20402/org/junit/tests/anotherpackage Log Message: Directory /cvsroot/junit/junit/org/junit/tests/anotherpackage added to the repository |
From: David S. <sa...@mi...> - 2006-06-19 18:33:35
|
Dan, I'm not sure you ever received a response to your kind offer. Right now, development is slow, as the current committers are swamped with other commitments (I may just be speaking for myself, however). The best way to start contributing is to find a bug that you can submit a small patch for--that minimizes the risk of spending a lot of time developing to the wrong requirements, and gives you a taste of the code. Also, stay active on this list--that way, when we get our heads above water, we'll remember to keep in touch. On another note, there is a project at junitext.org that claims to include a GUI runner--you may want to check into that. Good luck, David Saff Dan Kaplan wrote: > Hello, > > I'm interested in becoming a contributor for JUnit 4. I'm especially > interested in writing the JUnit 4 GUI runner. > > It was hard for me to find a document that describes how to become a > contributor except for the CVS link that explains how to anonymously > check out code. I didn't feel comfortable doing that, especially > since there may be a set of requirements I should work off of. So > could one of you kindly explain or point me to a link that explains > how to become a contributor for JUnit 4? > > Thanks a lot, > Dan |
From: Matthias S. <mat...@gm...> - 2006-06-13 10:25:26
|
Hello there, You plan to build a GUI for JUnit 4.x? There already is such a project, why don't you have a look at it at http://junitext.org/. If you want changes/bugfixes made to the current JUnit release, why don't you attach an Eclipse patch? Regards, Matt -------- Original-Nachricht -------- Datum: Tue, 13 Jun 2006 11:32:29 +0200 Von: Ernst Reissner <re...@ar...> An: jun...@li... Betreff: [Junit-devel] RunListener > Hi all, > > i currently try to substitute for the 3.x GUI. > to this end i have to implement an > > org.junit.runner.notification.RunListener > > i think it would be nice, if > testIgnored(Description description) > would include some reason for ignore as given by the annotation. > also: maybe nice to see timeouts at start of testcase. > > > what do you think about it? > > greetings > > ernst > > > _______________________________________________ > Junit-devel mailing list > Jun...@li... > https://lists.sourceforge.net/lists/listinfo/junit-devel -- "Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ... Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail |
From: Ernst R. <re...@ar...> - 2006-06-13 09:37:11
|
Hi again, it seems strange to me that fail() is implemented as fail((String)null) because this causes strange output i'd prefer fail(""). greetings ernst |
From: Ernst R. <re...@ar...> - 2006-06-13 09:35:46
|
Hi all, i currently try to substitute for the 3.x GUI. to this end i have to implement an org.junit.runner.notification.RunListener i think it would be nice, if testIgnored(Description description) would include some reason for ignore as given by the annotation. also: maybe nice to see timeouts at start of testcase. what do you think about it? greetings ernst |