Community
Participate
Working Groups
I am trying to create a test case suite that runs JUnit 5 test cases, but have run into the following very obscure error: ``` java.lang.NoSuchMethodError: org.junit.runner.Description.createSuiteDescription(Ljava/lang/String;Ljava/io/Serializable;[Ljava/lang/annotation/Annotation;)Lorg/junit/runner/Description; at org.junit.platform.runner.JUnitPlatformTestTree.createJUnit4Description(JUnitPlatformTestTree.java:108) at org.junit.platform.runner.JUnitPlatformTestTree.buildDescription(JUnitPlatformTestTree.java:95) at org.junit.platform.runner.JUnitPlatformTestTree.lambda$buildDescriptionTree$0(JUnitPlatformTestTree.java:86) at java.lang.Iterable.forEach(Unknown Source) at java.util.Collections$SynchronizedCollection.forEach(Unknown Source) at java.util.Collections$UnmodifiableCollection.forEach(Unknown Source) at org.junit.platform.runner.JUnitPlatformTestTree.buildDescriptionTree(JUnitPlatformTestTree.java:86) at org.junit.platform.runner.JUnitPlatformTestTree.generateSuiteDescription(JUnitPlatformTestTree.java:72) at org.junit.platform.runner.JUnitPlatformTestTree.<init>(JUnitPlatformTestTree.java:50) at org.junit.platform.runner.JUnitPlatform.generateTestTree(JUnitPlatform.java:144) at org.junit.platform.runner.JUnitPlatform.<init>(JUnitPlatform.java:129) at org.junit.platform.runner.JUnitPlatform.<init>(JUnitPlatform.java:122) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:90) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:76) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:526) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210) ``` My current investigations has shown that: * The faulting method, `org.junit.runner.Description.createSuiteDescription` exists with the following signature: ``` public static Description createSuiteDescription(String name, Annotation... annotations) ``` * However, for some reason, it is called with the following parameters instead: ``` createSuiteDescription(Ljava/lang/String;Ljava/io/Serializable;[Ljava/lang/annotation/Annotation;) ``` * This is weird, since I have confirmed in the next step down the stack trace (in JUnitPlatformTestTree.java:108), that the call there calls the function as follows: ``` return Description.createSuiteDescription(name, identifier.getUniqueId()); ``` I have also tried this with different versions of the JUnit platform now, but still continue to run into this error. Thus I believe the error might be related to eclipse, especially since that is where the stack trace leads at the very bottom level. I can't say for sure though, since this error is very obscure to me. For reference, the class that causes this is looking as follows: ``` import org.junit.platform.runner.JUnitPlatform; import org.junit.platform.suite.api.SelectClasses; import org.junit.runner.RunWith; import io.cesonia.camelot.knight.database.MongoDBOperationsTest; @RunWith(JUnitPlatform.class) @SelectClasses({ MongoDBOperationsTest.class }) public class KnightTestCaseSuite { } ``` While my Gradle imports look as follows: ``` testCompile 'com.tngtech.jgiven:jgiven-junit5:0.15.2' testCompile('org.junit.jupiter:junit-jupiter:5.6.0') testCompile('org.junit.platform:junit-platform-runner:1.5.2') testCompile('org.junit.platform:junit-platform-suite-api:1.5.2') testCompile('org.junit.platform:junit-platform-launcher:1.5.2') testCompile('org.junit.platform:junit-platform-engine:1.5.2') testCompile('org.junit.platform:junit-platform-commons:1.5.2') testImplementation 'junit:junit:4.12' ```
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.