Skip to content

Commit cc9a4df

Browse files
committed
Fix problems in JUnitLaunchRequirements
- The JUNIT5_VERSIONS VersionRange should be [1, 6) because [1, 5) excludes Junit 5. - The case for TestKindRegistry.JUNIT5_TEST_KIND_ID should add JUNIT5_JDT_RUNTIME_PLUGIN not JUNIT4_JDT_RUNTIME_PLUGIN. - The search range `new VersionRange(VersionRange.LEFT_OPEN, version, version, VersionRange.RIGHT_OPEN))` is always empty so should use `new VersionRange(VersionRange.LEFT_CLOSED, version, version, VersionRange.RIGHT_CLOSED))`.
1 parent f5f3f82 commit cc9a4df

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/JUnitLaunchRequirements.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class JUnitLaunchRequirements {
4343
public static final String JUNIT4_JDT_RUNTIME_PLUGIN = "org.eclipse.jdt.junit4.runtime"; //$NON-NLS-1$
4444
public static final String JUNIT5_JDT_RUNTIME_PLUGIN = "org.eclipse.jdt.junit5.runtime"; //$NON-NLS-1$
4545

46-
private static final VersionRange JUNIT5_VERSIONS = new VersionRange("[1, 5)"); //$NON-NLS-1$
46+
private static final VersionRange JUNIT5_VERSIONS = new VersionRange("[1, 6)"); //$NON-NLS-1$
4747

4848
// we add launcher and jupiter.engine to support @RunWith(JUnitPlatform.class)
4949
private static final Map<String, List<String>> JUNIT5_RUN_WITH_BUNDLES = new LinkedHashMap<>();
@@ -81,7 +81,7 @@ public static Collection<String> getRequiredJunitRuntimeEclipsePlugins(ILaunchCo
8181
case org.eclipse.jdt.internal.junit.launcher.TestKindRegistry.JUNIT3_TEST_KIND_ID -> {
8282
} // Nothing to add for JUnit-3
8383
case org.eclipse.jdt.internal.junit.launcher.TestKindRegistry.JUNIT4_TEST_KIND_ID -> plugins.add(JUNIT4_JDT_RUNTIME_PLUGIN);
84-
case org.eclipse.jdt.internal.junit.launcher.TestKindRegistry.JUNIT5_TEST_KIND_ID -> plugins.add(JUNIT4_JDT_RUNTIME_PLUGIN);
84+
case org.eclipse.jdt.internal.junit.launcher.TestKindRegistry.JUNIT5_TEST_KIND_ID -> plugins.add(JUNIT5_JDT_RUNTIME_PLUGIN);
8585
default -> throw new IllegalArgumentException("Unsupported junit test kind: " + testKind.getId()); //$NON-NLS-1$
8686
}
8787
return plugins;
@@ -108,7 +108,7 @@ private static void addAbsentRequirements(Set<BundleDescription> requirements, M
108108
List<IPluginModelBase> models = allBundles.computeIfAbsent(id, k -> new ArrayList<>());
109109
boolean replace = !models.isEmpty() && models.stream().anyMatch(m -> !m.getBundleDescription().getVersion().equals(version));
110110
if (replace || models.stream().noneMatch(m -> m.getBundleDescription().isResolved())) {
111-
IPluginModelBase model = findRequiredPluginInTargetOrHost(requirement.getSymbolicName(), new VersionRange(VersionRange.LEFT_OPEN, version, version, VersionRange.RIGHT_OPEN));
111+
IPluginModelBase model = findRequiredPluginInTargetOrHost(requirement.getSymbolicName(), new VersionRange(VersionRange.LEFT_CLOSED, version, version, VersionRange.RIGHT_CLOSED));
112112
if (replace) {
113113
String startLevel = null;
114114
for (IPluginModelBase m : models) {

0 commit comments

Comments
 (0)