diff --git a/manual/Tasks/junit.html b/manual/Tasks/junit.html
index 95a2ffc0f..2a9ebeb6c 100644
--- a/manual/Tasks/junit.html
+++ b/manual/Tasks/junit.html
@@ -526,6 +526,18 @@ the name of the resulting class (without suffix). It defaults to java-tmp-dir
Only run test if the named property is not set. |
No |
+
+ skipNonTests |
+ Do not pass any classes that do not contain JUnit tests to the test runner.
+ This prevents non tests from appearing as test errors in test results.
+ Tests are identified by looking for the @Test annotation on any methods in concrete classes
+ that don't extend junit.framework.TestCase , or for public/protected methods with
+ names starting with 'test' in concrete classes that extend junit.framework.TestCase .
+ Classes marked with the JUnit4 org.junit.runner.RunWith or
+ org.junit.runner.Suite.SuiteClasses annotations are also passed to JUnit for execution,
+ as is any class with a public/protected no-argument suite method. |
+ No. Default is false. |
+
Tests can define their own formatters via nested
@@ -604,6 +616,18 @@ supported.
Only run tests if the named property is not set. |
No |
+
+ skipNonTests |
+ Do not pass any classes that do not contain JUnit tests to the test runner.
+ This prevents non tests from appearing as test errors in test results.
+ Tests are identified by looking for the @Test annotation on any methods in concrete classes
+ that don't extend junit.framework.TestCase , or for public/protected methods with
+ names starting with 'test' in concrete classes that extend junit.framework.TestCase .
+ Classes marked with the JUnit4 org.junit.runner.RunWith or
+ org.junit.runner.Suite.SuiteClasses annotations are also passed to JUnit for execution,
+ as is any class with a public/protected no-argument suite method. |
+ No. Default is false. |
+
Batchtests can define their own formatters via nested
@@ -649,7 +673,7 @@ supported.
to your junit
task.
-Since Ant 1.8.2 the enableTestListenerEvents
diff --git a/src/etc/testcases/taskdefs/optional/junit.xml b/src/etc/testcases/taskdefs/optional/junit.xml
index f44337a3d..465e7f3e5 100644
--- a/src/etc/testcases/taskdefs/optional/junit.xml
+++ b/src/etc/testcases/taskdefs/optional/junit.xml
@@ -292,6 +292,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
public class T1 extends
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java
index 6d993717e..55e7a5d5c 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java
@@ -42,6 +42,7 @@ public abstract class BaseTest {
// CheckStyle:VisibilityModifier ON
private Object ifCond, unlessCond;
+ private boolean skipNonTests;
/**
* Set the filtertrace attribute.
@@ -229,4 +230,12 @@ public abstract class BaseTest {
public void setErrorProperty(String errorProperty) {
this.errorProperty = errorProperty;
}
+
+ public void setSkipNonTests(boolean skipNonTests) {
+ this.skipNonTests = skipNonTests;
+ }
+
+ public boolean isSkipNonTests() {
+ return skipNonTests;
+ }
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java
index 64a7bc8d2..e0e38b760 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java
@@ -191,6 +191,7 @@ public final class BatchTest extends BaseTest {
test.setTodir(this.destDir);
test.setFailureProperty(failureProperty);
test.setErrorProperty(errorProperty);
+ test.setSkipNonTests(isSkipNonTests());
Enumeration list = this.formatters.elements();
while (list.hasMoreElements()) {
test.addFormatter((FormatterElement) list.nextElement());
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/Constants.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/Constants.java
index 12876a0a9..5b8016a82 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/Constants.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/Constants.java
@@ -37,4 +37,5 @@ public class Constants {
static final String TESTSFILE = "testsfile=";
static final String TERMINATED_SUCCESSFULLY = "terminated successfully";
static final String LOG_FAILED_TESTS="logfailedtests=";
+ static final String SKIP_NON_TESTS = "skipNonTests=";
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
index 462ed4d4a..94b68d025 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
@@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs.optional.junit;
import java.io.File;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.OutputStream;
import java.io.BufferedOutputStream;
import java.lang.reflect.Field;
@@ -310,11 +311,7 @@ public class FormatterElement {
JUnitTaskMirror.JUnitResultFormatterMirror r =
(JUnitTaskMirror.JUnitResultFormatterMirror) o;
if (useFile && outFile != null) {
- try {
- out = new BufferedOutputStream(new FileOutputStream(outFile));
- } catch (java.io.IOException e) {
- throw new BuildException("Unable to open file " + outFile, e);
- }
+ out = new DelayedFileOutputStream(outFile);
}
r.setOutput(out);
@@ -361,4 +358,44 @@ public class FormatterElement {
return new String[] {"plain", "xml", "brief", "failure"};
}
}
+
+ /**
+ * A standard FileOutputStream creates a file as soon as it's opened. This
+ * class delays the creation of the file until the first time a caller attempts
+ * to write to it so we don't end up with empty files if the listeners don't use
+ * them.
+ */
+ private static class DelayedFileOutputStream extends OutputStream {
+
+ private BufferedOutputStream outputStream;
+ private final File file;
+
+ public DelayedFileOutputStream(File file) {
+ this.file = file;
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ synchronized (this) {
+ if (outputStream == null) {
+ outputStream = new BufferedOutputStream(new FileOutputStream(file));
+ }
+ }
+ outputStream.write(b);
+ }
+
+ @Override
+ public void flush() throws IOException {
+ if (outputStream != null) {
+ outputStream.flush();
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ if (outputStream != null) {
+ outputStream.close();
+ }
+ }
+ }
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
index 82ca4f2b4..6af8b99b0 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
@@ -976,6 +976,7 @@ public class JUnitTask extends Task {
cmd.createArgument().setValue(Constants.TESTSFILE + casesFile);
}
+ cmd.createArgument().setValue(Constants.SKIP_NON_TESTS + String.valueOf(test.isSkipNonTests()));
cmd.createArgument().setValue(Constants.FILTERTRACE + test.getFiltertrace());
cmd.createArgument().setValue(Constants.HALT_ON_ERROR + test.getHaltonerror());
cmd.createArgument().setValue(Constants.HALT_ON_FAILURE
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
index d14074e50..a6d36c051 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
@@ -30,6 +30,7 @@ import java.io.PrintStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Properties;
@@ -37,6 +38,7 @@ import java.util.StringTokenizer;
import java.util.Vector;
import junit.framework.AssertionFailedError;
import junit.framework.Test;
+import junit.framework.TestCase;
import junit.framework.TestFailure;
import junit.framework.TestListener;
import junit.framework.TestResult;
@@ -71,7 +73,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
/**
* Holds the registered formatters.
*/
- private Vector formatters = new Vector();
+ private Vector formatters = new Vector();
/**
* Collects TestResults.
@@ -463,6 +465,13 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
}
junit4 = junit4TestAdapterClass != null;
+ if (junitTest.isSkipNonTests()) {
+ if (!containsTests( testClass, junit4)) {
+ return;
+ }
+ }
+
+
if (junit4) {
// Let's use it!
Class[] formalParams;
@@ -563,6 +572,93 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
}
}
+ private static boolean containsTests(Class> testClass, boolean isJUnit4) {
+ Class testAnnotation = null;
+ Class suiteAnnotation = null;
+ Class runWithAnnotation = null;
+
+ try {
+ testAnnotation = Class.forName("org.junit.Test");
+ } catch (ClassNotFoundException e) {
+ if (isJUnit4) {
+ // odd - we think we're JUnit4 but don't support the test annotation. We therefore can't have any tests!
+ return false;
+ }
+ // else... we're a JUnit3 test and don't need the annotation
+ }
+
+ try {
+ suiteAnnotation = Class.forName("org.junit.Suite.SuiteClasses");
+ } catch(ClassNotFoundException ex) {
+ // ignore - we don't have this annotation so make sure we don't check for it
+ }
+ try {
+ runWithAnnotation = Class.forName("org.junit.runner.RunWith");
+ } catch(ClassNotFoundException ex) {
+ // also ignore as this annotation doesn't exist so tests can't use it
+ }
+
+
+ if (!isJUnit4 && !TestCase.class.isAssignableFrom(testClass)) {
+ //a test we think is JUnit3 but does not extend TestCase. Can't really be a test.
+ return false;
+ }
+
+ // check if we have any inner classes that contain suitable test methods
+ for (Class> innerClass : testClass.getDeclaredClasses()) {
+ if (containsTests(innerClass, isJUnit4) || containsTests(innerClass, !isJUnit4)) {
+ return true;
+ }
+ }
+
+ if (Modifier.isAbstract(testClass.getModifiers()) || Modifier.isInterface(testClass.getModifiers())) {
+ // can't instantiate class and no inner classes are tests either
+ return false;
+ }
+
+ if (isJUnit4) {
+ if (suiteAnnotation != null && testClass.getAnnotation(suiteAnnotation) != null) {
+ // class is marked as a suite. Let JUnit try and work its magic on it.
+ return true;
+ }
+ if (runWithAnnotation != null && testClass.getAnnotation(runWithAnnotation) != null) {
+ /* Class is marked with @RunWith. If this class is badly written (no test methods, multiple
+ * constructors, private constructor etc) then the class is automatically run and fails in the
+ * IDEs I've tried... so I'm happy handing the class to JUnit to try and run, and let JUnit
+ * report a failure if a bad test case is provided. Trying to do anything else is likely to
+ * result in us filtering out cases that could be valid for future versions of JUnit so would
+ * just increase future maintenance work.
+ */
+ return true;
+ }
+ }
+
+ for (Method m : testClass.getMethods()) {
+ if (isJUnit4) {
+ // check if suspected JUnit4 classes have methods with @Test annotation
+ if (m.getAnnotation(testAnnotation) != null) {
+ return true;
+ }
+ } else {
+ // check if JUnit3 class have public or protected no-args methods starting with names starting with test
+ if (m.getName().startsWith("test") && m.getParameterTypes().length == 0
+ && (Modifier.isProtected(m.getModifiers()) || Modifier.isPublic(m.getModifiers()))) {
+ return true;
+ }
+ }
+ // check if JUnit3 or JUnit4 test have a public or protected, static,
+ // no-args 'suite' method
+ if (m.getName().equals("suite") && m.getParameterTypes().length == 0
+ && (Modifier.isProtected(m.getModifiers()) || Modifier.isPublic(m.getModifiers()))
+ && Modifier.isStatic(m.getModifiers())) {
+ return true;
+ }
+ }
+
+ // no test methods found
+ return false;
+ }
+
/**
* Returns what System.exit() would return in the standalone version.
*
@@ -792,6 +888,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
boolean outputToFormat = true;
boolean logFailedTests = true;
boolean logTestListenerEvents = false;
+ boolean skipNonTests = false;
if (args.length == 0) {
@@ -845,6 +942,9 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
} else if (args[i].startsWith(Constants.LOG_FAILED_TESTS)) {
logFailedTests = Project.toBoolean(
args[i].substring(Constants.LOG_FAILED_TESTS.length()));
+ } else if (args[i].startsWith(Constants.SKIP_NON_TESTS)) {
+ skipNonTests = Project.toBoolean(
+ args[i].substring(Constants.SKIP_NON_TESTS.length()));
}
}
@@ -884,6 +984,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
t.setTodir(new File(st.nextToken()));
t.setOutfile(st.nextToken());
t.setProperties(props);
+ t.setSkipNonTests(skipNonTests);
code = launch(t, testMethodNames, haltError, stackfilter, haltFail,
showOut, outputToFormat,
logTestListenerEvents);
@@ -911,6 +1012,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
} else {
JUnitTest t = new JUnitTest(args[0]);
t.setProperties(props);
+ t.setSkipNonTests(skipNonTests);
returnCode = launch(
t, methods, haltError, stackfilter, haltFail,
showOut, outputToFormat, logTestListenerEvents);
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
index 98e76bec6..730ecf0c9 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
@@ -333,4 +333,29 @@ public class JUnitTaskTest extends BuildFileTest {
executeTarget("testTestMethods");
}
+ public void testNonTestsSkipped() throws Exception {
+ executeTarget("testNonTests");
+ assertFalse("Test result should not exist as test was skipped - TEST-org.example.junit.NonTestMissed.xml", getProject().getResource("out/TEST-org.example.junit.NonTestMissed.xml").isExists());
+ assertFalse("Test result should not exist as test was skipped - TEST-org.example.junit.JUnit3NonTestMissed.xml", getProject().getResource("out/TEST-org.example.junit.JUnit3TestMissed.xml").isExists());
+ assertFalse("Test result should not exist as test was skipped - TEST-org.example.junit.AbstractTestMissed.xml", getProject().getResource("out/TEST-org.example.junit.AbstractTestMissed.xml").isExists());
+ assertFalse("Test result should not exist as test was skipped - TEST-org.example.junit.AbstractJUnit3TestMissed.xml", getProject().getResource("out/TEST-org.example.junit.AbstractJUnit3TestMissed.xml").isExists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractTestNotMissed.xml", getProject().getResource("out/TEST-org.example.junit.AbstractTestNotMissed.xml").isExists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractJUnit3TestNotMissed.xml", getProject().getResource("out/TEST-org.example.junit.AbstractJUnit3TestNotMissed.xml").isExists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.TestNotMissed.xml", getProject().getResource("out/TEST-org.example.junit.TestNotMissed.xml").isExists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.JUnit3TestNotMissed.xml", getProject().getResource("out/TEST-org.example.junit.JUnit3TestNotMissed.xml").isExists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.TestWithSuiteNotMissed.xml", getProject().getResource("out/TEST-org.example.junit.TestWithSuiteNotMissed.xml").isExists());
+
+ executeTarget("testNonTestsRun");
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.NonTestMissed.xml", getProject().getResource("out/TEST-org.example.junit.NonTestMissed.xml").isExists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.JUnit3NonTestMissed.xml", getProject().getResource("out/TEST-org.example.junit.JUnit3NonTestMissed.xml").isExists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.TestNotMissed.xml", getProject().getResource("out/TEST-org.example.junit.TestNotMissed.xml").isExists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.JUnit3TestNotMissed.xml", getProject().getResource("out/TEST-org.example.junit.JUnit3TestNotMissed.xml").isExists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractTestMissed.xml", getProject().getResource("out/TEST-org.example.junit.AbstractTestMissed.xml").isExists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractTestNotMissed.xml", getProject().getResource("out/TEST-org.example.junit.AbstractTestNotMissed.xml").isExists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractJUnit3TestMissed.xml", getProject().getResource("out/TEST-org.example.junit.AbstractJUnit3TestMissed.xml").isExists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.JUnit3NonTestMissed.xml", getProject().getResource("out/TEST-org.example.junit.JUnit3NonTestMissed.xml").isExists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.TestWithSuiteNotMissed.xml", getProject().getResource("out/TEST-org.example.junit.TestWithSuiteNotMissed.xml").isExists());
+
+ }
+
}
diff --git a/src/tests/junit/org/example/junit/AbstractJUnit3TestMissed.java b/src/tests/junit/org/example/junit/AbstractJUnit3TestMissed.java
new file mode 100644
index 000000000..e2bb73adc
--- /dev/null
+++ b/src/tests/junit/org/example/junit/AbstractJUnit3TestMissed.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.example.junit;
+
+import junit.framework.TestCase;
+
+public abstract class AbstractJUnit3TestMissed extends TestCase {
+
+ public void testNothing() {
+ }
+
+}
diff --git a/src/tests/junit/org/example/junit/AbstractJUnit3TestNotMissed.java b/src/tests/junit/org/example/junit/AbstractJUnit3TestNotMissed.java
new file mode 100644
index 000000000..40f2b4a5d
--- /dev/null
+++ b/src/tests/junit/org/example/junit/AbstractJUnit3TestNotMissed.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.example.junit;
+
+import junit.framework.TestCase;
+
+public abstract class AbstractJUnit3TestNotMissed extends TestCase {
+
+ public void testNothing() {
+ }
+
+ public static class InnerAbstractTestNotMissed extends AbstractJUnit3TestNotMissed {
+
+ }
+
+}
diff --git a/src/tests/junit/org/example/junit/AbstractTestMissed.java b/src/tests/junit/org/example/junit/AbstractTestMissed.java
new file mode 100644
index 000000000..8df6adfde
--- /dev/null
+++ b/src/tests/junit/org/example/junit/AbstractTestMissed.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.example.junit;
+
+import org.junit.Test;
+
+
+public abstract class AbstractTestMissed {
+
+ @Test
+ public void testNothing() {
+ }
+
+}
diff --git a/src/tests/junit/org/example/junit/AbstractTestNotMissed.java b/src/tests/junit/org/example/junit/AbstractTestNotMissed.java
new file mode 100644
index 000000000..79b925e4d
--- /dev/null
+++ b/src/tests/junit/org/example/junit/AbstractTestNotMissed.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.example.junit;
+
+import org.junit.Test;
+
+public abstract class AbstractTestNotMissed {
+
+ @Test
+ public void testNothing() {
+ }
+
+ public static class InnerAbstractTestNotMissed extends AbstractTestNotMissed {
+
+ }
+
+}
diff --git a/src/tests/junit/org/example/junit/JUnit3NonTestMissed.java b/src/tests/junit/org/example/junit/JUnit3NonTestMissed.java
new file mode 100644
index 000000000..7a4a00f97
--- /dev/null
+++ b/src/tests/junit/org/example/junit/JUnit3NonTestMissed.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.example.junit;
+
+import junit.framework.TestCase;
+
+public class JUnit3NonTestMissed extends TestCase {
+
+ public void notATest() {
+ //this isn't a test but shouldn't case an error
+ }
+}
diff --git a/src/tests/junit/org/example/junit/JUnit3TestNotMissed.java b/src/tests/junit/org/example/junit/JUnit3TestNotMissed.java
new file mode 100644
index 000000000..338012de1
--- /dev/null
+++ b/src/tests/junit/org/example/junit/JUnit3TestNotMissed.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.example.junit;
+
+import junit.framework.TestCase;
+
+public class JUnit3TestNotMissed extends TestCase {
+
+ public void testNothing() {
+ // don't fail
+ }
+
+}
diff --git a/src/tests/junit/org/example/junit/NonTestMissed.java b/src/tests/junit/org/example/junit/NonTestMissed.java
new file mode 100644
index 000000000..5a76d1718
--- /dev/null
+++ b/src/tests/junit/org/example/junit/NonTestMissed.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.example.junit;
+
+public class NonTestMissed {
+
+ public void notATest() {
+ //this isn't a test but shouldn't case an error
+ }
+}
diff --git a/src/tests/junit/org/example/junit/TestNotMissed.java b/src/tests/junit/org/example/junit/TestNotMissed.java
new file mode 100644
index 000000000..1c967e05e
--- /dev/null
+++ b/src/tests/junit/org/example/junit/TestNotMissed.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.example.junit;
+
+
+import org.junit.Test;
+
+public class TestNotMissed {
+
+ @Test
+ public void testNothing() {
+ // don't fail
+ }
+}
diff --git a/src/tests/junit/org/example/junit/TestWithSuiteNotMissed.java b/src/tests/junit/org/example/junit/TestWithSuiteNotMissed.java
new file mode 100644
index 000000000..e5cdf93f1
--- /dev/null
+++ b/src/tests/junit/org/example/junit/TestWithSuiteNotMissed.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.example.junit;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestWithSuiteNotMissed {
+
+ public static Test suite() {
+ TestSuite test = new TestSuite("meh");
+ JUnit3TestNotMissed testCase = new JUnit3TestNotMissed();
+ testCase.setName("testNothing");
+ test.addTest(testCase);
+ return test;
+ }
+}