Skip to content

Commit 4e7ee47

Browse files
vogellaclaude
andcommitted
Fix LineContentBoundsDrawingTest JUnit 5 parameterized test migration
This commit fixes a compilation error introduced during the JUnit 5 migration of LineContentBoundsDrawingTest. The test was using a mix of JUnit 4 @RunWith(Parameterized.class) with JUnit 5 annotations, causing: "No ParameterResolver registered for parameter [java.lang.String arg0]" Changes: - Converted from JUnit 4 constructor-based parameterization to JUnit 5 method parameter-based parameterization - Removed @RunWith(Parameterized.class) and related JUnit 4 imports - Changed @parameters to provide method source via @MethodSource - Converted @test to @ParameterizedTest(name = "{0}") - Removed constructor that accepted String parameter - Modified test method to accept String parameter directly - Added required JUnit 5 parameterized test imports to MANIFEST.MF: - org.junit.jupiter.params - org.junit.jupiter.params.provider The test now compiles successfully with 0 errors. Note: 5 pre-existing test failures remain from before the JUnit 5 migration (verified by checking git history showing no logic changes to those tests). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 2c6cc72 commit 4e7ee47

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

tests/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ Import-Package: org.mockito,
3030
org.mockito.invocation,
3131
org.mockito.stubbing,
3232
org.junit.jupiter.api;version="[5.14.0,6.0.0)",
33+
org.junit.jupiter.params;version="[5.14.0,6.0.0)",
34+
org.junit.jupiter.params.provider;version="[5.14.0,6.0.0)",
3335
org.junit.platform.suite.api;version="[1.14.0,2.0.0)"

tests/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/source/inlined/LineContentBoundsDrawingTest.java

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
import org.junit.jupiter.api.AfterEach;
1616
import org.junit.jupiter.api.Assertions;
1717
import org.junit.jupiter.api.BeforeEach;
18-
import org.junit.jupiter.api.Test;
19-
import org.junit.runner.RunWith;
20-
import org.junit.runners.Parameterized;
21-
import org.junit.runners.Parameterized.Parameters;
18+
import org.junit.jupiter.params.ParameterizedTest;
19+
import org.junit.jupiter.params.provider.MethodSource;
2220

2321
import org.eclipse.swt.SWT;
2422
import org.eclipse.swt.custom.StyledText;
@@ -48,9 +46,7 @@
4846
* This test verify that the bounds of the text as returned by StyledText.getTextBounds()
4947
* actually match what's printed on the widget.
5048
*/
51-
@RunWith(Parameterized.class)
5249
public class LineContentBoundsDrawingTest {
53-
@Parameters(name="{0}")
5450
public static String[] contents() {
5551
return new String[] {
5652
"annotation inside text",
@@ -59,12 +55,6 @@ public static String[] contents() {
5955
};
6056
}
6157

62-
private final String text;
63-
64-
public LineContentBoundsDrawingTest(String text) {
65-
this.text = text;
66-
}
67-
6858
public static final class AccessAllAnnoations implements IAnnotationAccess {
6959
@Override
7060
public Object getType(Annotation annotation) {
@@ -113,14 +103,15 @@ public void tearDown() {
113103
fParent = null;
114104
}
115105

116-
@Test
117-
public void testTextBoundsMatchPaintedArea() {
106+
@ParameterizedTest(name = "{0}")
107+
@MethodSource("contents")
108+
public void testTextBoundsMatchPaintedArea(String text) {
118109
fParent.setLayout(new FillLayout());
119110

120111
// Create source viewer and initialize the content
121112
ISourceViewer sourceViewer = new SourceViewer(fParent,null,
122113
SWT.V_SCROLL | SWT.BORDER);
123-
sourceViewer.setDocument(new Document(this.text), new AnnotationModel());
114+
sourceViewer.setDocument(new Document(text), new AnnotationModel());
124115

125116
// Initialize inlined annotations support
126117
InlinedAnnotationSupport support = new InlinedAnnotationSupport();

0 commit comments

Comments
 (0)