Bug 560929 - JUnitPlatform NoSuchMethodError @ org.junit.runner.Description.createSuiteDescription
Summary: JUnitPlatform NoSuchMethodError @ org.junit.runner.Description.createSuiteDes...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.14   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-09 11:09 EDT by Kira Resari CLA
Modified: 2024-02-19 18:53 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kira Resari CLA 2020-03-09 11:09:34 EDT
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'
```
Comment 1 Eclipse Genie CLA 2022-02-28 13:55:05 EST
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.
Comment 2 Eclipse Genie CLA 2024-02-19 18:53:38 EST
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.