visited) {
- if (annotationType == null || !visited.add(annotationType)) {
- return false;
- }
-
- final String qualifiedName = annotationType.getQualifiedName();
-
- // Direct check for @Testable meta-annotation
- if ("org.junit.platform.commons.annotation.Testable".equals(qualifiedName)) {
- return true;
- }
-
- // Check for common JUnit Jupiter test annotations
- if (qualifiedName.startsWith("org.junit.jupiter.api.")) {
- if (qualifiedName.equals("org.junit.jupiter.api.Test") ||
- qualifiedName.equals("org.junit.jupiter.api.RepeatedTest") ||
- qualifiedName.equals("org.junit.jupiter.api.ParameterizedTest") ||
- qualifiedName.equals("org.junit.jupiter.api.TestFactory") ||
- qualifiedName.equals("org.junit.jupiter.api.TestTemplate")) {
- return true;
- }
- }
-
- // Check meta-annotations
- for (final IAnnotationBinding metaAnnotation : annotationType.getAnnotations()) {
- if (metaAnnotation == null) {
- continue;
- }
- final ITypeBinding metaAnnotationType = metaAnnotation.getAnnotationType();
- if (isTestableAnnotation(metaAnnotationType, visited)) {
- return true;
- }
- }
-
- return false;
- }
-
- private boolean isNestedTestClass(ITypeBinding nestedType) {
- for (final IAnnotationBinding annotation : nestedType.getAnnotations()) {
- if (annotation == null) {
- continue;
- }
- final ITypeBinding annotationType = annotation.getAnnotationType();
- if (annotationType != null &&
- "org.junit.jupiter.api.Nested".equals(annotationType.getQualifiedName())) {
- return isTest(nestedType);
- }
- }
- return false;
- }
-}
diff --git a/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/searcher/JUnit6TestSearcher.java b/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/searcher/JUnit6TestSearcher.java
index d9e3fc2e..48aed200 100644
--- a/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/searcher/JUnit6TestSearcher.java
+++ b/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/searcher/JUnit6TestSearcher.java
@@ -13,37 +13,18 @@
import com.microsoft.java.test.plugin.model.TestKind;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.junit.launcher.TestKindRegistry;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
/**
* Test searcher for JUnit 6 (Jupiter API 6.x).
- *
- * JUnit 6 is an evolutionary release built on top of JUnit 5's Jupiter platform.
- * It maintains full backward compatibility with JUnit 5 while adding improvements
- * and new features. This class extends JUnit5TestSearcher to inherit all the
- * Jupiter test detection logic, only overriding the parts specific to JUnit 6:
- *
- * - Test kind identification (JUnit6 vs JUnit5)
- * - Test finder instance (uses JUnit6TestFinder for proper classpath resolution)
- *
- *
+ *
+ * JUnit 5 and JUnit 6 share the same Jupiter test discovery semantics. The
+ * JUnit version is distinguished when selecting the test kind and runtime.
+ *
* @see JUnit5TestSearcher
- * @see JUnit6TestFinder
*/
public class JUnit6TestSearcher extends JUnit5TestSearcher {
- private static final JUnit6TestFinder JUNIT6_TEST_FINDER = new JUnit6TestFinder();
-
@Override
public TestKind getTestKind() {
return TestKind.JUnit6;
@@ -53,20 +34,4 @@ public TestKind getTestKind() {
public String getJdtTestKind() {
return TestKindRegistry.JUNIT6_TEST_KIND_ID;
}
-
- @Override
- public boolean isTestClass(IType type) throws JavaModelException {
- return JUNIT6_TEST_FINDER.isTest(type);
- }
-
- @Override
- public Set findTestItemsInContainer(IJavaElement element, IProgressMonitor monitor) throws CoreException {
- final Set types = new HashSet<>();
- try {
- JUNIT6_TEST_FINDER.findTestsInContainer(element, types, monitor);
- } catch (OperationCanceledException e) {
- return Collections.emptySet();
- }
- return types;
- }
}