Closed UTD-MrPeterson closed 2 weeks ago
Hi @UTD-MrPeterson Please update the junit version to 5.10+ and try again
I had the same issue and resolved it by updating the junit jupiter version. I added the following line to the build.gradle file (its a Spring project)
ext['junit-jupiter.version'] = '5.11.3'
PS: The problem did occur for me even though it was not a newly cloned repository.
Changed title and pin the issue.
The description of Test Runner for Java tells us, that it's fine to use JUnit 5.1.0+
. The change log does not tell anything about this.
It's pretty annoying when your tests are suddenly failing with such an error and you have to debug this until finding out that somehow an update of the Test Runner Plugin maybe is the problem. (Keep in mind, that you sometimes upgrade plugins and don't see the problem immediately, but days later...)
But I want to understand the problem:
What is the dependency between the projects JUnit version and Test Runner for Java ? I think there is also a dependency from Test Runner for Java and the Java Language Support Plugin. Is this true?
Or in other words: Is there something we could do to prevent this kind of error in the future? Is it somehow possible to make the JUnit version in the project independent from the plugins version? (My team member also use other IDEs... not sure if we always find "the right JUnit version" for all IDEs)
What is the dependency between the projects JUnit version and Test Runner for Java ? I think there is also a dependency from Test Runner for Java and the Java Language Support Plugin. Is this true?
The problem is that the junit test runner embedded in this extension, which is an upstream dependency changes the requirement.
Is there something we could do to prevent this kind of error in the future?
If it's maven project, maybe we can just update the documents as the approach. If it's gradle, we have feature called 'Delegate test to Gradle', which will directly let gradle to run the tests, just like running thtough gradle command in terminal.
After the upgrade to 0.43 this morning newly cloned repositories (several repositories from my students) will not run JUnits. The stack trace I get is:
java.lang.NoSuchMethodError: 'void org.junit.platform.commons.util.CollectionUtils.forEachInReverseOrder(java.util.List, java.util.function.Consumer)' at org.junit.platform.launcher.core.LauncherConfigurationParameters$Builder.build(LauncherConfigurationParameters.java:143) at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:129) at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:112) at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.(JUnit5TestLoader.java:37)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
at java.base/java.lang.Class.newInstance(Class.java:645)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createRawTestLoader(RemoteTestRunner.java:372)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createLoader(RemoteTestRunner.java:367)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.defaultInit(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.init(RemoteTestRunner.java:226)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
The project is configured to use JUnit 5.9.1.
Downgrading to version 0.42 resolved this error.
Already-cloned repositories continue to work normally on version 0.43, for what it's worth; it seems to be only newly-cloned ones that fail.