Skip to content

Bug: java.lang.NoSuchMethodError #153

Description

@danglotb

Hello,

I'm trying to run Flacoco on this project but I have the following error:

Exception in thread "main" java.lang.NoSuchMethodError: 'org.junit.platform.engine.ConfigurationParameters org.junit.platform.launcher.TestPlan.getConfigurationParameters()'
	at org.junit.platform.launcher.listeners.UniqueIdTrackingListener.testPlanExecutionStarted(UniqueIdTrackingListener.java:143)
	at org.junit.platform.launcher.core.TestExecutionListenerRegistry$CompositeTestExecutionListener.lambda$testPlanExecutionStarted$6(TestExecutionListenerRegistry.java:97)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at org.junit.platform.launcher.core.TestExecutionListenerRegistry.notifyTestExecutionListeners(TestExecutionListenerRegistry.java:59)
	at org.junit.platform.launcher.core.TestExecutionListenerRegistry.access$100(TestExecutionListenerRegistry.java:28)
	at org.junit.platform.launcher.core.TestExecutionListenerRegistry$CompositeTestExecutionListener.testPlanExecutionStarted(TestExecutionListenerRegistry.java:97)
	at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:183)
	at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
	at eu.stamp_project.testrunner.runner.JUnit5Runner.run(JUnit5Runner.java:98)
	at eu.stamp_project.testrunner.runner.coverage.JUnit5OnlineJacocoRunner.executeCoveredTestPerTestMethod(JUnit5OnlineJacocoRunner.java:30)
	at eu.stamp_project.testrunner.runner.coverage.JacocoOnlineRunner.runCoveredTestResultPerTestMethod(JacocoOnlineRunner.java:41)
	at eu.stamp_project.testrunner.runner.coverage.JUnit5OnlineJacocoRunner.main(JUnit5OnlineJacocoRunner.java:48)

Here the toString() of the used FlacocoConfig:

FlacocoConfig{workspace='/home/benjamin/workspace/diff-jjoules-demo/.', projectPath='/home/benjamin/workspace/diff-jjoules-demo', srcJavaDir=[/home/benjamin/workspace/diff-jjoules-demo/src/main/java], srcTestDir=[/home/benjamin/workspace/diff-jjoules-demo/src/test], binJavaDir=[/home/benjamin/workspace/diff-jjoules-demo/target/classes], binTestDir=[/home/benjamin/workspace/diff-jjoules-demo/target/test-classes], classpath='/home/benjamin/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.8.2/junit-jupiter-api-5.8.2.jar:/home/benjamin/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/home/benjamin/.m2/repository/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar:/home/benjamin/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/home/benjamin/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.8.2/junit-jupiter-engine-5.8.2.jar:/home/benjamin/.m2/repository/org/junit/platform/junit-platform-engine/1.8.2/junit-platform-engine-1.8.2.jar:/home/benjamin/.m2/repository/org/junit/platform/junit-platform-launcher/1.8.2/junit-platform-launcher-1.8.2.jar:/home/benjamin/.m2/repository/junit/junit/4.13.2/junit-4.13.2.jar:/home/benjamin/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar', customJUnitClasspath='null',  customJacocoClasspath='null',  mavenHome='/home/benjamin/.m2/repository/',  coverTests=false, testRunnerVerbose=true,  testRunnerTimeoutInMs=1000000,  testRunnerJVMArgs='null',  threshold=0.0,  includeZeros=false, complianceLevel=8,  testDetectionStrategy=CLASSLOADER,  ignoredTests=[],  jUnit4Tests=[],  jUnit5Tests=[], jacocoIncludes=[], jacocoExcludes=[], family=SPECTRUM_BASED, spectrumFormula=OCHIAI, computeSpoonResults=false}
[0] INFO Flacoco - Running Flacoco...
Parsing --sourceBinaries /home/benjamin/workspace/diff-jjoules-demo/target/classes --testBinaries /home/benjamin/workspace/diff-jjoules-demo/target/test-classes --class fr.davidson.diff_jjoules_demo.TestCode   --coverage-detail DETAIL_COMPRESSED

Seems that there is a conflict between the versions of org.junit.platform.launcher where the method getConfigurationParameters() of ConfigurationParameters has been introduced in 1.8 while Flacoco is running in 1.3:

@API(status=MAINTAINED,
     since="1.8")
public ConfigurationParameters getConfigurationParameters()
Get the ConfigurationParameters for this test plan.
Returns:
    the configuration parameters; never null
Since:
    1.8

source

However, I did try to bump the versions in Flacoco (and in STAMP-project/test-runner) but it did not work 😞

Have you any idea?

Thank you very much!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions