2020import static org .hamcrest .Matchers .instanceOf ;
2121import static org .hamcrest .Matchers .is ;
2222import static org .hamcrest .Matchers .not ;
23- import static org .junit .Assert .assertEquals ;
24- import static org .junit .Assert .assertFalse ;
25- import static org .junit .Assert .assertTrue ;
23+ import static org .junit .jupiter . api . Assertions .assertEquals ;
24+ import static org .junit .jupiter . api . Assertions .assertFalse ;
25+ import static org .junit .jupiter . api . Assertions .assertTrue ;
2626import static org .mockito .ArgumentMatchers .anyBoolean ;
2727import static org .mockito .ArgumentMatchers .anyInt ;
2828import static org .mockito .ArgumentMatchers .anyString ;
3333
3434import java .util .function .Predicate ;
3535
36- import org .junit .After ;
37- import org .junit .Before ;
38- import org .junit .Test ;
36+ import org .junit .jupiter . api . AfterEach ;
37+ import org .junit .jupiter . api . BeforeEach ;
38+ import org .junit .jupiter . api . Test ;
3939import org .mockito .Mockito ;
4040
4141import org .eclipse .swt .SWT ;
@@ -86,14 +86,14 @@ private void setFindAndReplaceString(IFindReplaceLogic findReplaceLogic, String
8686 findReplaceLogic .setReplaceString (replaceString );
8787 }
8888
89- @ After
89+ @ AfterEach
9090 public void disposeShell () {
9191 if (parentShell != null ) {
9292 parentShell .dispose ();
9393 }
9494 }
9595
96- @ Before
96+ @ BeforeEach
9797 public void setupShell () {
9898 parentShell = new Shell ();
9999 }
@@ -252,8 +252,8 @@ public void testPerformSelectAndReplaceRegEx() {
252252 expectStatusEmpty (findReplaceLogic );
253253
254254 status = findReplaceLogic .performSelectAndReplace ();
255- assertEquals ("Status wasn't correctly returned" , false , status );
256- assertEquals ("Text shouldn't have been changed" , " Hello World !" , textViewer .getDocument ().get ());
255+ assertEquals (false , status , "Status wasn't correctly returned" );
256+ assertEquals ("Hello World !" , textViewer .getDocument ().get (), "Text shouldn't have been changed" );
257257 expectStatusIsCode (findReplaceLogic , FindStatus .StatusCode .NO_MATCH );
258258 }
259259
@@ -288,12 +288,12 @@ public void testPerformSelectAndReplaceRegExWithLinebreaks() {
288288 expectStatusEmpty (findReplaceLogic );
289289
290290 setFindAndReplaceString (findReplaceLogic , """
291- """ , " " );
291+ """ , " " );
292292 status = findReplaceLogic .performSelectAndReplace ();
293- assertEquals ("Status wasn't correctly returned" , false , status );
294- assertEquals ("Text shouldn't have been changed" , " ""
293+ assertEquals (false , status , "Status wasn't correctly returned" );
294+ assertEquals ("""
295295 Hello!
296- World!""" , textViewer .getDocument ().get ());
296+ World!""" , textViewer .getDocument ().get (), "Text shouldn't have been changed" );
297297 }
298298
299299 @ Test
@@ -324,8 +324,8 @@ public void testPerformSelectAndReplaceWithConfigurationChanges() {
324324 expectStatusEmpty (findReplaceLogic );
325325
326326 status = findReplaceLogic .performSelectAndReplace ();
327- assertEquals ("Status wasn't correctly returned" , false , status );
328- assertEquals ("Text shouldn't have been changed" , " Hello World ! !" , textViewer .getDocument ().get ());
327+ assertEquals (false , status , "Status wasn't correctly returned" );
328+ assertEquals ("Hello World ! !" , textViewer .getDocument ().get (), "Text shouldn't have been changed" );
329329 expectStatusIsCode (findReplaceLogic , FindStatus .StatusCode .NO_MATCH );
330330 }
331331
@@ -355,20 +355,20 @@ public void testPerformReplaceAndFind_caseInsensitive() {
355355 setFindAndReplaceString (findReplaceLogic , "<Replace>" , " " );
356356
357357 boolean status = findReplaceLogic .performReplaceAndFind ();
358- assertTrue ("replace should have been performed" , status );
358+ assertTrue (status , "replace should have been performed" );
359359 assertThat (textViewer .getDocument ().get (), equalTo ("Hello World<replace>!" ));
360360 assertThat (findReplaceLogic .getTarget ().getSelectionText (), equalTo ("<replace>" ));
361361 expectStatusEmpty (findReplaceLogic );
362362
363363 setFindAndReplaceString (findReplaceLogic , "<replace>" , " " );
364364 status = findReplaceLogic .performReplaceAndFind ();
365- assertTrue ("replace should have been performed" , status );
365+ assertTrue (status , "replace should have been performed" );
366366 assertThat (textViewer .getDocument ().get (), equalTo ("Hello World !" ));
367367 expectStatusIsCode (findReplaceLogic , FindStatus .StatusCode .NO_MATCH );
368368
369369 status = findReplaceLogic .performReplaceAndFind ();
370- assertFalse ("replace should not have been performed" , status );
371- assertEquals ("Text shouldn't have been changed" , " Hello World !" , textViewer .getDocument ().get ());
370+ assertFalse (status , "replace should not have been performed" );
371+ assertEquals ("Hello World !" , textViewer .getDocument ().get (), "Text shouldn't have been changed" );
372372 expectStatusIsCode (findReplaceLogic , FindStatus .StatusCode .NO_MATCH );
373373 }
374374
@@ -381,12 +381,12 @@ public void testPerformReplaceAndFind_caseSensitive() {
381381 setFindAndReplaceString (findReplaceLogic , "<replace>" , " " );
382382
383383 boolean status = findReplaceLogic .performReplaceAndFind ();
384- assertTrue ("replace should have been performed" , status );
384+ assertTrue (status , "replace should have been performed" );
385385 assertThat (textViewer .getDocument ().get (), equalTo ("Hello<Replace>World !" ));
386386 assertThat (findReplaceLogic .getTarget ().getSelectionText (), equalTo (" " ));
387387
388388 status = findReplaceLogic .performReplaceAndFind ();
389- assertFalse ("replace should not have been performed" , status );
389+ assertFalse (status , "replace should not have been performed" );
390390 assertThat (textViewer .getDocument ().get (), equalTo ("Hello<Replace>World !" ));
391391 assertThat (findReplaceLogic .getTarget ().getSelectionText (), equalTo (" " ));
392392 }
@@ -400,20 +400,20 @@ public void testPerformReplaceAndFind_caseSensitiveAndIncremental() {
400400 setFindAndReplaceString (findReplaceLogic , "<Replace>" , " " );
401401
402402 boolean status = findReplaceLogic .performReplaceAndFind ();
403- assertTrue ("replace should have been performed" , status );
403+ assertTrue (status , "replace should have been performed" );
404404 assertThat (textViewer .getDocument ().get (), equalTo ("Hello World<replace>!" ));
405405 assertThat (findReplaceLogic .getTarget ().getSelectionText (), equalTo ("<replace>" ));
406406 expectStatusEmpty (findReplaceLogic );
407407
408408 setFindAndReplaceString (findReplaceLogic , "<replace>" , " " );
409409 status = findReplaceLogic .performReplaceAndFind ();
410- assertTrue ("replace should have been performed" , status );
410+ assertTrue (status , "replace should have been performed" );
411411 assertThat (textViewer .getDocument ().get (), equalTo ("Hello World !" ));
412412 expectStatusIsCode (findReplaceLogic , FindStatus .StatusCode .NO_MATCH );
413413
414414 status = findReplaceLogic .performReplaceAndFind ();
415- assertFalse ("replace should not have been performed" , status );
416- assertEquals ("Text shouldn't have been changed" , " Hello World !" , textViewer .getDocument ().get ());
415+ assertFalse (status , "replace should not have been performed" );
416+ assertEquals ("Hello World !" , textViewer .getDocument ().get (), "Text shouldn't have been changed" );
417417 expectStatusIsCode (findReplaceLogic , FindStatus .StatusCode .NO_MATCH );
418418 }
419419
@@ -484,8 +484,8 @@ private void executeReplaceAndFindRegExTest(TextViewer textViewer, IFindReplaceL
484484
485485 setFindAndReplaceString (findReplaceLogic , "<(\\ w*)>" , " " );
486486 status = findReplaceLogic .performReplaceAndFind ();
487- assertEquals ("Status wasn't correctly returned" , false , status );
488- assertEquals ("Text shouldn't have been changed" , " Hello World ! !" , textViewer .getDocument ().get ());
487+ assertEquals (false , status , "Status wasn't correctly returned" );
488+ assertEquals ("Hello World ! !" , textViewer .getDocument ().get (), "Text shouldn't have been changed" );
489489 expectStatusIsCode (findReplaceLogic , FindStatus .StatusCode .NO_MATCH );
490490 }
491491
0 commit comments