Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clicking on a ParametrizedTest #1735

Merged
merged 5 commits into from
Nov 27, 2024

Conversation

gzsombor
Copy link
Contributor

@gzsombor gzsombor commented Oct 26, 2024

What it does

When we click on the 'grouping' element for a ParametrizedTest, the code tries to find the method without the parameter types, but the search actually tries to find a parameter-less method with the same name.

How to test

  1. Have a JUnit test:
	@ParameterizedTest
	@ValueSource(ints = {1,2,3})
	void x(int l) {
		fail("Not yet implemented");
	}

	@ParameterizedTest
	@ValueSource(ints = {4})
	void y(int l) {
		fail("Not yet implemented");
	}
 
	@TestFactory
	Collection<DynamicTest> dynamicTestsWithCollection() {
		return Arrays.asList(DynamicTest.dynamicTest("First test", () -> {
			fail("Bad luck");
		}), DynamicTest.dynamicTest("Second test", () -> {
			fail("Bad luck");
		})
		);
	}

	@ParameterizedTest
	@MethodSource("testArgs")
	void testInvisibleCharacters(String msg) {
        }

	private static List<String> testArgs() {
		return List.of("aaa\u0000MISSING", "bbb\u0000MISSING");
	}


  1. Run the tests,
  2. In the test results, try to click on x(int) or y(int)
  3. A dialog came up complaining of the missing method, instead of navigating to the actual code.
  4. Check that the test cases under testInvisibleCharacters shows as aaa MISSING and bbb MISSING instead of aaa and bbb

Author checklist

@eclipse-jdt-bot
Copy link
Contributor

eclipse-jdt-bot commented Nov 11, 2024

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

org.eclipse.jdt.junit.core/META-INF/MANIFEST.MF
org.eclipse.jdt.ui.unittest.junit.feature/feature.xml
org.eclipse.jdt.ui.unittest.junit.feature/pom.xml
org.eclipse.jdt.ui.unittest.junit/META-INF/MANIFEST.MF
org.eclipse.jdt.ui.unittest.junit/pom.xml

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From caefcce741c9617e426e5f5dca9bcf4b05a440ca Mon Sep 17 00:00:00 2001
From: Eclipse JDT Bot <[email protected]>
Date: Wed, 27 Nov 2024 06:34:25 +0000
Subject: [PATCH] Version bump(s) for 4.35 stream


diff --git a/org.eclipse.jdt.junit.core/META-INF/MANIFEST.MF b/org.eclipse.jdt.junit.core/META-INF/MANIFEST.MF
index a20259ab37..2926397879 100644
--- a/org.eclipse.jdt.junit.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.junit.core/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.jdt.junit.core
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jdt.junit.core;singleton:=true
-Bundle-Version: 3.13.400.qualifier
+Bundle-Version: 3.13.500.qualifier
 Bundle-Activator: org.eclipse.jdt.internal.junit.JUnitCorePlugin
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: %providerName
diff --git a/org.eclipse.jdt.ui.unittest.junit.feature/feature.xml b/org.eclipse.jdt.ui.unittest.junit.feature/feature.xml
index 1a6a1340db..4a4243c800 100644
--- a/org.eclipse.jdt.ui.unittest.junit.feature/feature.xml
+++ b/org.eclipse.jdt.ui.unittest.junit.feature/feature.xml
@@ -2,7 +2,7 @@
 <feature
       id="org.eclipse.jdt.ui.unittest.junit.feature"
       label="%featureName"
-      version="1.1.500.qualifier"
+      version="1.1.600.qualifier"
       provider-name="%provider"
       license-feature="org.eclipse.license"
       license-feature-version="0.0.0">
diff --git a/org.eclipse.jdt.ui.unittest.junit.feature/pom.xml b/org.eclipse.jdt.ui.unittest.junit.feature/pom.xml
index 0c3e3c8862..1a12ee4c9b 100644
--- a/org.eclipse.jdt.ui.unittest.junit.feature/pom.xml
+++ b/org.eclipse.jdt.ui.unittest.junit.feature/pom.xml
@@ -20,7 +20,7 @@
   </parent>
   <groupId>org.eclipse.jdt.feature</groupId>
   <artifactId>org.eclipse.jdt.ui.unittest.junit.feature</artifactId>
-  <version>1.1.500-SNAPSHOT</version>
+  <version>1.1.600-SNAPSHOT</version>
   <packaging>eclipse-feature</packaging>
   <build>
      <plugins>
diff --git a/org.eclipse.jdt.ui.unittest.junit/META-INF/MANIFEST.MF b/org.eclipse.jdt.ui.unittest.junit/META-INF/MANIFEST.MF
index becd8104bb..b81e2f2cd8 100644
--- a/org.eclipse.jdt.ui.unittest.junit/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.ui.unittest.junit/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.jdt.ui.unittest.junit
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jdt.ui.unittest.junit;singleton:=true
-Bundle-Version: 1.1.500.qualifier
+Bundle-Version: 1.1.600.qualifier
 Bundle-Activator: org.eclipse.jdt.ui.unittest.junit.JUnitTestPlugin
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: %providerName
diff --git a/org.eclipse.jdt.ui.unittest.junit/pom.xml b/org.eclipse.jdt.ui.unittest.junit/pom.xml
index 05ed1f45a5..2ec0580f39 100644
--- a/org.eclipse.jdt.ui.unittest.junit/pom.xml
+++ b/org.eclipse.jdt.ui.unittest.junit/pom.xml
@@ -18,6 +18,6 @@
   </parent>
   <groupId>org.eclipse.jdt</groupId>
   <artifactId>org.eclipse.jdt.ui.unittest.junit</artifactId>
-  <version>1.1.500-SNAPSHOT</version>
+  <version>1.1.600-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
-- 
2.47.0

Further information are available in Common Build Issues - Missing version increments.

@gzsombor gzsombor force-pushed the fix-parametrized-test-selection branch from d2dfc1f to cc74343 Compare November 12, 2024 07:45
@gzsombor gzsombor force-pushed the fix-parametrized-test-selection branch from cc74343 to f3a0f0d Compare November 26, 2024 19:58
gzsombor and others added 4 commits November 27, 2024 07:30
When we click on the 'grouping' element for a ParametrizedTest, the code
tries to find the method without the parameter types, but the search
actually tries to find a parameter-less method with the same name.
Previously if the variable contained a '\0' the rest of the string
was not displayed, with this fix, the rest of the string shows up too
@gzsombor gzsombor force-pushed the fix-parametrized-test-selection branch from 60d0665 to 40ec14e Compare November 27, 2024 06:30
@akurtakov
Copy link
Contributor

@jjohnstn Would you please review this one?

@jjohnstn
Copy link
Contributor

@akurtakov Will do now.

Copy link
Contributor

@jjohnstn jjohnstn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine.

@jjohnstn jjohnstn merged commit f1dfac5 into eclipse-jdt:master Nov 27, 2024
10 checks passed
@gzsombor gzsombor deleted the fix-parametrized-test-selection branch November 27, 2024 23:23
@gzsombor
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants