Notification texts go here Contact Us Buy Now!

NoSuchMethodError: 'java.util.Set org.junit.platform.engine.TestDescriptor.getAncestors()

This code will display the NoSuchMethodError: "java.util.Set org.junit.platform.engine.TestDescriptor.getAncestors()". Here are some possible solutions to this error:

Solution 1: Update Gradle Dependencies

Add the following dependency to the build.gradle file:

testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

Alternatively, you can use STS 4.20.0 distro based on Eclipse 4.28 or refer to the GitHub issue below for more workarounds and an explanation of the problem:

https://github.com/eclipse/buildship/issues/1265

Solution 2: Add Missing Dependency

In some cases, the error can be caused by a missing dependency in the pom.xml file. Ensure that the following dependency is present:

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>

Solution 3: Update junit-platform-launcher Dependency

For STS 4.21.0.RELEASE, update the junit-platform-launcher dependency to version 1.8.2 in the pom.xml file:

<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.8.2</version>
<scope>test</scope>
</dependency>

Solution 4: Migrate to JUnit 5.10.2

For Eclipse for Java users, migrating from JUnit 5.9.2 to 5.10.2 in the pom.xml file may resolve the issue.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.