java.lang.NoSuchMethodError: org.junit.platform.commons.util.Preconditions.notNull
See original GitHub issueWhen running tests, get this:
Exception in thread "main" java.lang.NoSuchMethodError: org.junit.platform.commons.util.Preconditions.notNull([Ljava/lang/Object;Ljava/lang/String;)[Ljava/lang/Object;
at org.junit.platform.launcher.core.DefaultLauncher.registerTestExecutionListeners(DefaultLauncher.java:71)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:37)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Any idea?
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Running JUnit tests in IntelliJ, getting: java.lang ...
Running JUnit tests in IntelliJ, getting: java.lang.NoSuchMethodError: org.junit.platform.commons.util.Preconditions.notNull · Ask Question.
Read more >Fixing the NoSuchMethodError JUnit Error | Baeldung
Learn how to fix the NoSuchMethodError and NoClassDefFoundError JUnit errors.
Read more >JUnit 5 User Guide
The JUnit Platform serves as a foundation for launching testing ... assertEquals; import example.util. ... RetentionPolicy; import java.lang.annotation.
Read more >junit-team/junit5 - Gitter
ClassNotFoundException: org.junit.platform.launcher.core.LauncherFactory at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.
Read more >org.junit.platform.commons.util.ReflectionUtils Maven / Gradle ...
BOTTOM_UP; import static org.junit.platform.commons.util.ReflectionUtils.HierarchyTraversalMode.TOP_DOWN; import java.io.File; import java.lang.reflect.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, AS 2.3.3 is most likely the culprit here. The blog post you linked to at the top of this issue described how IJ 2016.x is compiled against an older milestone of JUnit 5. I’m pretty certain that this affects AS 2.3 as well. I don’t know the version of IntelliJ it’s built against, but I’m fairly certain that it’s not a 2017 build.
So for the time being, I’m afraid you either need to update your AS to a more recent version, or wait until the next stable build & use the Gradle task for unit tests until then…
After reading this, I added this to my dependencies:
But now I get:
According to https://github.com/junit-team/junit5/issues/586 this is related with using an incompatible launcher version…? But it passed Gradle check at least, I tried first with M3 and Gradle didn’t let me.