11/*******************************************************************************
2- * Copyright (c) 2019, 2024 Emmanuel Chebbi and others.
2+ * Copyright (c) 2019, 2026 Emmanuel Chebbi and others.
33 *
44 * This program and the accompanying materials
55 * are made available under the terms of the Eclipse Public License 2.0
1414package org .eclipse .ui .tests .dialogs ;
1515
1616import 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
2121import java .util .Arrays ;
2222import java .util .HashMap ;
2323import java .util .HashSet ;
2424import java .util .List ;
2525import java .util .Map ;
26- import java .util .Set ;
2726import java .util .Map .Entry ;
27+ import java .util .Set ;
2828
2929import org .eclipse .core .resources .IFile ;
3030import org .eclipse .core .resources .IProject ;
4141import org .eclipse .ui .dialogs .FilteredResourcesSelectionDialog ;
4242import org .eclipse .ui .internal .decorators .DecoratorManager ;
4343import 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 ();
@@ -87,7 +87,7 @@ public void testSingleSelectionAndNoInitialSelectionWithInitialPattern() {
8787
8888 List <Object > selected = getSelectedItems (dialog );
8989
90- assertFalse ("One file should be selected by default" , selected . isEmpty () );
90+ assertFalse (selected . isEmpty (), "One file should be selected by default" );
9191 }
9292
9393 /**
@@ -108,7 +108,7 @@ public void testSingleSelectionAndOneInitialSelectionWithInitialPattern() {
108108
109109 List <Object > selected = getSelectedItems (dialog );
110110
111- assertEquals ("One file should be selected by default" , asList (FILES .get ("foo.txt" )), selected );
111+ assertEquals (asList (FILES .get ("foo.txt" )), selected , "One file should be selected by default" );
112112 }
113113
114114 /**
@@ -130,7 +130,7 @@ public void testSingleSelectionAndOneInitialNonExistingSelectionWithInitialPatte
130130
131131 List <Object > selected = getSelectedItems (dialog );
132132
133- assertTrue ("No file should be selected by default" , selected . isEmpty () );
133+ assertTrue (selected . isEmpty (), "No file should be selected by default" );
134134 }
135135
136136 /**
@@ -150,7 +150,7 @@ public void testSingleSelectionAndOneInitialSelectionWithoutInitialPattern() {
150150
151151 List <Object > selected = getSelectedItems (dialog );
152152
153- assertTrue ("No file should be selected by default" , selected . isEmpty () );
153+ assertTrue (selected . isEmpty (), "No file should be selected by default" );
154154 }
155155
156156 /**
@@ -172,7 +172,7 @@ public void testSingleSelectionAndOneFilteredSelection() {
172172
173173 List <Object > selected = getSelectedItems (dialog );
174174
175- assertTrue ("No file should be selected by default" , selected . isEmpty () );
175+ assertTrue (selected . isEmpty (), "No file should be selected by default" );
176176 }
177177
178178 /**
@@ -194,7 +194,7 @@ public void testSingleSelectionAndTwoInitialSelectionsWithInitialPattern() {
194194
195195 List <Object > selected = getSelectedItems (dialog );
196196
197- assertEquals (" The first file should be selected by default", asList ( FILES . get ( "foo.txt" )), selected );
197+ assertEquals (asList ( FILES . get ( "foo.txt" )), selected , " The first file should be selected by default" );
198198 }
199199
200200 /**
@@ -215,7 +215,7 @@ public void testMultiSelectionAndNoInitialSelectionWithInitialPattern() {
215215
216216 List <Object > selected = getSelectedItems (dialog );
217217
218- assertFalse ("One file should be selected by default" , selected . isEmpty () );
218+ assertFalse (selected . isEmpty (), "One file should be selected by default" );
219219 }
220220
221221 /**
@@ -237,7 +237,7 @@ public void testMultiSelectionAndOneInitialSelectionWithInitialPattern() {
237237
238238 List <Object > selected = getSelectedItems (dialog );
239239
240- assertEquals ("One file should be selected by default" , asList (FILES .get ("foo.txt" )), selected );
240+ assertEquals (asList (FILES .get ("foo.txt" )), selected , "One file should be selected by default" );
241241 }
242242
243243 /**
@@ -257,7 +257,7 @@ public void testMultiSelectionAndOneInitialSelectionWithoutInitialPattern() {
257257
258258 List <Object > selected = getSelectedItems (dialog );
259259
260- assertTrue ("No file should be selected by default" , selected . isEmpty () );
260+ assertTrue (selected . isEmpty (), "No file should be selected by default" );
261261 }
262262
263263 /**
@@ -279,7 +279,7 @@ public void testMultiSelectionAndTwoInitialNonExistingSelectionWithInitialPatter
279279
280280 List <Object > selected = getSelectedItems (dialog );
281281
282- assertTrue ("No file should be selected by default" , selected . isEmpty () );
282+ assertTrue (selected . isEmpty (), "No file should be selected by default" );
283283 }
284284
285285 /**
@@ -303,7 +303,7 @@ public void testMultiSelectionAndSomeInitialNonExistingSelectionWithInitialPatte
303303 Set <IFile > expectedSelection = new HashSet <>(asList (FILES .get ("bar.txt" ), FILES .get ("foofoo" )));
304304 boolean allInitialElementsAreSelected = expectedSelection .equals (new HashSet <>(selected ));
305305
306- assertTrue ("Two files should be selected by default" , allInitialElementsAreSelected );
306+ assertTrue (allInitialElementsAreSelected , "Two files should be selected by default" );
307307 }
308308
309309 /**
@@ -328,7 +328,7 @@ public void testMultiSelectionAndTwoInitialSelectionsWithInitialPattern() {
328328 boolean initialElementsAreSelected = selected .containsAll (initialSelection )
329329 && initialSelection .containsAll (selected );
330330
331- assertTrue ("Two files should be selected by default" , initialElementsAreSelected );
331+ assertTrue (initialElementsAreSelected , "Two files should be selected by default" );
332332 }
333333
334334 /**
@@ -354,7 +354,7 @@ public void testMultiSelectionAndTwoInitialFilteredSelections() {
354354 boolean initialElementsAreSelected = selected .containsAll (expectedSelection )
355355 && expectedSelection .containsAll (selected );
356356
357- assertTrue ("Two files should be selected by default" , initialElementsAreSelected );
357+ assertTrue (initialElementsAreSelected , "Two files should be selected by default" );
358358 }
359359
360360 private FilteredResourcesSelectionDialog createDialog (boolean multiSelection ) {
@@ -394,34 +394,34 @@ private void createProject() throws CoreException {
394394
395395 for (String fileName : FILE_NAMES ) {
396396 DisplayHelper .waitForCondition (display , 1000 , () -> project .getFile (fileName ).exists ());
397- assertTrue ("File was not created" , project .getFile (fileName ).exists ());
397+ assertTrue (project .getFile (fileName ).exists (), "File was not created" );
398398 }
399399 }
400400
401- @ After
401+ @ AfterEach
402402 public void doTearDown () throws Exception {
403403 if (dialog != null ) {
404404 dialog .close ();
405405 }
406406 if (project != null ) {
407407 // Process any pending UI events before cleanup
408408 processUIEvents ();
409-
409+
410410 try {
411411 // Wait for decorator jobs to finish
412412 Job .getJobManager ().wakeUp (DecoratorManager .FAMILY_DECORATE );
413413 Job .getJobManager ().join (DecoratorManager .FAMILY_DECORATE , null );
414-
414+
415415 // Wait for any resource jobs that might be running
416416 Job .getJobManager ().join (ResourcesPlugin .FAMILY_MANUAL_REFRESH , null );
417417 Job .getJobManager ().join (ResourcesPlugin .FAMILY_AUTO_REFRESH , null );
418-
418+
419419 // Process UI events again after joining jobs
420420 processUIEvents ();
421-
421+
422422 // Try to delete with proper progress monitor and retry mechanism
423423 deleteProjectWithRetry (project );
424-
424+
425425 } catch (Exception e ) {
426426 // try to get a stacktrace which jobs still has project open so that it can not
427427 // be deleted:
@@ -495,7 +495,7 @@ private void waitForDialogRefresh() {
495495 private void deleteProjectWithRetry (IProject projectToDelete ) throws CoreException {
496496 final int MAX_RETRY = 5 ;
497497 CoreException lastException = null ;
498-
498+
499499 for (int i = 0 ; i < MAX_RETRY ; i ++) {
500500 try {
501501 projectToDelete .delete (true , true , new NullProgressMonitor ());
@@ -514,7 +514,7 @@ private void deleteProjectWithRetry(IProject projectToDelete) throws CoreExcepti
514514 }
515515 }
516516 }
517-
517+
518518 // If we get here, all retries failed
519519 if (lastException != null ) {
520520 throw lastException ;
0 commit comments