What Junit is trying to tell me when he throws a "NoTestsRemainException",

I am trying to run Apache POI project tests, but I get the following exception. I've seen this a few times already, but every time I get completely lost, what is JUnit trying to tell me?

Javadoc simply indicates β€œThrew when the filter removes all tests from the runner.”, But that does not mean the Ant filter, because it is thrown inside JUnit, so which filter might remove the tests here? How can I debug / fix the Ant file that gives me this message?

test-main: [junit] java.lang.NoClassDefFoundError: org/junit/runner/manipulation/NoTestsRemainException [junit] at java.lang.Class.getDeclaredMethods0(Native Method) [junit] at java.lang.Class.privateGetDeclaredMethods(Class.java:2451) [junit] at java.lang.Class.getMethod0(Class.java:2694) [junit] at java.lang.Class.getMethod(Class.java:1622) [junit] at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494) [junit] at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486) [junit] Caused by: java.lang.ClassNotFoundException: org.junit.runner.manipulation.NoTestsRemainException [junit] at java.net.URLClassLoader$1.run(URLClassLoader.java:366) [junit] at java.net.URLClassLoader$1.run(URLClassLoader.java:355) [junit] at java.security.AccessController.doPrivileged(Native Method) [junit] at java.net.URLClassLoader.findClass(URLClassLoader.java:354) [junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:423) [junit] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) [junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:356) [junit] ... 6 more [junit] Exception in thread "main" [junit] java.io.FileNotFoundException: C:\workspaces\devtools\source\poi-trunk\junitvmwatcher937297744.properties (The system cannot find the file specified) [junit] at java.io.FileInputStream.open(Native Method) [junit] at java.io.FileInputStream.<init>(FileInputStream.java:138) [junit] at java.io.FileReader.<init>(FileReader.java:72) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(JUnitTask.java:1115) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:896) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:819) [junit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [junit] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [junit] at java.lang.reflect.Method.invoke(Method.java:601) [junit] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) [junit] at org.apache.tools.ant.Task.perform(Task.java:348) [junit] at org.apache.tools.ant.Target.execute(Target.java:357) [junit] at org.apache.tools.ant.Target.performTasks(Target.java:385) [junit] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337) [junit] at org.apache.tools.ant.Project.executeTarget(Project.java:1306) [junit] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [junit] at org.apache.tools.ant.Project.executeTargets(Project.java:1189) [junit] at org.apache.tools.ant.Main.runBuild(Main.java:758) [junit] at org.apache.tools.ant.Main.startAnt(Main.java:217) [junit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) [junit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) 
+4
source share
1 answer

After deepening this problem, I found out that this is caused by starting a newer Ant with an older JUnit. In this case, it was Ant 1.7.1 and 1.8.2 against JUnit 3.8.1. Upgrading to JUnit 4.10 solved the problem!

+5
source

Source: https://habr.com/ru/post/1481177/


All Articles