Skip to content

Commit 45cc945

Browse files
vogellaclaude
andcommitted
Fix JUnit 5 migration issues in test files
This commit fixes test failures introduced during the JUnit 5 migration in PR #3410. Changes in FilteringAsyncContentAssistTests.java: - Changed import from org.junit.Ignore to org.junit.jupiter.api.Disabled - Replaced @ignore annotation with @disabled annotation and added reason message to properly skip the test - The test was failing because JUnit 5 does not recognize JUnit 4's @ignore annotation, causing a disabled test to run and fail Changes in ResourceInitialSelectionTest.java: - Migrated from JUnit 4 to JUnit 5 (file was missed in initial migration) - Updated imports: - org.junit.Assert → org.junit.jupiter.api.Assertions - org.junit.Before → org.junit.jupiter.api.BeforeEach - org.junit.After → org.junit.jupiter.api.AfterEach - Changed annotations: @before@beforeeach, @after → @AfterEach - Fixed assertion parameter order for JUnit 5 (message parameter moved from first to last position) - All 13 tests now pass successfully Test Results: - FilteringAsyncContentAssistTests: 7 tests run, 0 failures, 1 properly skipped - ResourceInitialSelectionTest: 13 tests run, 0 failures, 0 errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 58facde commit 45cc945

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed

tests/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/contentassist/FilteringAsyncContentAssistTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import org.junit.jupiter.api.AfterEach;
2626
import org.junit.jupiter.api.BeforeEach;
27-
import org.junit.Ignore;
27+
import org.junit.jupiter.api.Disabled;
2828
import org.junit.jupiter.api.Test;
2929

3030
import org.eclipse.swt.SWT;
@@ -288,7 +288,8 @@ public void testCA_WithFirstDelayedThenImmediateProposals() throws Exception {
288288
*
289289
* @throws Exception exception
290290
*/
291-
@Test @Ignore
291+
@Test
292+
@Disabled("Bug: filtering only applied after all CA processors have completed")
292293
public void testFastCompletionsNotFilteredUntilLongComplitionsCalculated() throws Exception {
293294
IDocument document = viewer.getDocument();
294295

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/ResourceInitialSelectionTest.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
package org.eclipse.ui.tests.dialogs;
1515

1616
import static java.util.Arrays.asList;
17-
import static org.junit.Assert.assertEquals;
18-
import static org.junit.Assert.assertFalse;
19-
import static org.junit.Assert.assertTrue;
17+
import static org.junit.jupiter.api.Assertions.assertEquals;
18+
import static org.junit.jupiter.api.Assertions.assertFalse;
19+
import static org.junit.jupiter.api.Assertions.assertTrue;
2020

2121
import java.util.Arrays;
2222
import java.util.HashMap;
@@ -41,9 +41,9 @@
4141
import org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog;
4242
import org.eclipse.ui.internal.decorators.DecoratorManager;
4343
import org.eclipse.ui.tests.harness.util.DisplayHelper;
44-
import org.junit.After;
45-
import org.junit.Before;
46-
import org.junit.Test;
44+
import org.junit.jupiter.api.AfterEach;
45+
import org.junit.jupiter.api.BeforeEach;
46+
import org.junit.jupiter.api.Test;
4747

4848
/**
4949
* Tests that FilteredResourcesSelectionDialog selects its initial selection
@@ -64,7 +64,7 @@ public class ResourceInitialSelectionTest {
6464
private IProject project;
6565

6666

67-
@Before
67+
@BeforeEach
6868
public void doSetUp() throws Exception {
6969
FILES.clear();
7070
createProject();
@@ -84,7 +84,7 @@ public void testSingleSelectionAndNoInitialSelectionWithInitialPattern() {
8484

8585
List<Object> selected = getSelectedItems(dialog);
8686

87-
assertFalse("One file should be selected by default", selected.isEmpty());
87+
assertFalse(selected.isEmpty(), "One file should be selected by default");
8888
}
8989

9090
/**
@@ -102,7 +102,7 @@ public void testSingleSelectionAndOneInitialSelectionWithInitialPattern() {
102102

103103
List<Object> selected = getSelectedItems(dialog);
104104

105-
assertEquals("One file should be selected by default", asList(FILES.get("foo.txt")), selected);
105+
assertEquals(asList(FILES.get("foo.txt")), selected, "One file should be selected by default");
106106
}
107107

108108
/**
@@ -121,7 +121,7 @@ public void testSingleSelectionAndOneInitialNonExistingSelectionWithInitialPatte
121121

122122
List<Object> selected = getSelectedItems(dialog);
123123

124-
assertTrue("No file should be selected by default", selected.isEmpty());
124+
assertTrue(selected.isEmpty(), "No file should be selected by default");
125125
}
126126

127127
/**
@@ -138,7 +138,7 @@ public void testSingleSelectionAndOneInitialSelectionWithoutInitialPattern() {
138138

139139
List<Object> selected = getSelectedItems(dialog);
140140

141-
assertTrue("No file should be selected by default", selected.isEmpty());
141+
assertTrue(selected.isEmpty(), "No file should be selected by default");
142142
}
143143

144144
/**
@@ -157,7 +157,7 @@ public void testSingleSelectionAndOneFilteredSelection() {
157157

158158
List<Object> selected = getSelectedItems(dialog);
159159

160-
assertTrue("No file should be selected by default", selected.isEmpty());
160+
assertTrue(selected.isEmpty(), "No file should be selected by default");
161161
}
162162

163163
/**
@@ -176,7 +176,7 @@ public void testSingleSelectionAndTwoInitialSelectionsWithInitialPattern() {
176176

177177
List<Object> selected = getSelectedItems(dialog);
178178

179-
assertEquals("The first file should be selected by default", asList(FILES.get("foo.txt")), selected);
179+
assertEquals(asList(FILES.get("foo.txt")), selected, "The first file should be selected by default");
180180
}
181181

182182
/**
@@ -194,7 +194,7 @@ public void testMultiSelectionAndNoInitialSelectionWithInitialPattern() {
194194

195195
List<Object> selected = getSelectedItems(dialog);
196196

197-
assertFalse("One file should be selected by default", selected.isEmpty());
197+
assertFalse(selected.isEmpty(), "One file should be selected by default");
198198
}
199199

200200
/**
@@ -213,7 +213,7 @@ public void testMultiSelectionAndOneInitialSelectionWithInitialPattern() {
213213

214214
List<Object> selected = getSelectedItems(dialog);
215215

216-
assertEquals("One file should be selected by default", asList(FILES.get("foo.txt")), selected);
216+
assertEquals(asList(FILES.get("foo.txt")), selected, "One file should be selected by default");
217217
}
218218

219219
/**
@@ -230,7 +230,7 @@ public void testMultiSelectionAndOneInitialSelectionWithoutInitialPattern() {
230230

231231
List<Object> selected = getSelectedItems(dialog);
232232

233-
assertTrue("No file should be selected by default", selected.isEmpty());
233+
assertTrue(selected.isEmpty(), "No file should be selected by default");
234234
}
235235

236236
/**
@@ -249,7 +249,7 @@ public void testMultiSelectionAndTwoInitialNonExistingSelectionWithInitialPatter
249249

250250
List<Object> selected = getSelectedItems(dialog);
251251

252-
assertTrue("No file should be selected by default", selected.isEmpty());
252+
assertTrue(selected.isEmpty(), "No file should be selected by default");
253253
}
254254

255255
/**
@@ -270,7 +270,7 @@ public void testMultiSelectionAndSomeInitialNonExistingSelectionWithInitialPatte
270270
Set<IFile> expectedSelection = new HashSet<>(asList(FILES.get("bar.txt"), FILES.get("foofoo")));
271271
boolean allInitialElementsAreSelected = expectedSelection.equals(new HashSet<>(selected));
272272

273-
assertTrue("Two files should be selected by default", allInitialElementsAreSelected);
273+
assertTrue(allInitialElementsAreSelected, "Two files should be selected by default");
274274
}
275275

276276
/**
@@ -292,7 +292,7 @@ public void testMultiSelectionAndTwoInitialSelectionsWithInitialPattern() {
292292
boolean initialElementsAreSelected = selected.containsAll(initialSelection)
293293
&& initialSelection.containsAll(selected);
294294

295-
assertTrue("Two files should be selected by default", initialElementsAreSelected);
295+
assertTrue(initialElementsAreSelected, "Two files should be selected by default");
296296
}
297297

298298
/**
@@ -315,7 +315,7 @@ public void testMultiSelectionAndTwoInitialFilteredSelections() {
315315
boolean initialElementsAreSelected = selected.containsAll(expectedSelection)
316316
&& expectedSelection.containsAll(selected);
317317

318-
assertTrue("Two files should be selected by default", initialElementsAreSelected);
318+
assertTrue(initialElementsAreSelected, "Two files should be selected by default");
319319
}
320320

321321
private FilteredResourcesSelectionDialog createDialog(boolean multiSelection) {
@@ -355,11 +355,11 @@ private void createProject() throws CoreException {
355355

356356
for (String fileName : FILE_NAMES) {
357357
DisplayHelper.waitForCondition(display, 1000, () -> project.getFile(fileName).exists());
358-
assertTrue("File was not created", project.getFile(fileName).exists());
358+
assertTrue(project.getFile(fileName).exists(), "File was not created");
359359
}
360360
}
361361

362-
@After
362+
@AfterEach
363363
public void doTearDown() throws Exception {
364364
if (dialog != null) {
365365
dialog.close();

0 commit comments

Comments
 (0)