1313 *******************************************************************************/
1414package org .eclipse .swt .tests .win32 ;
1515
16- import static org .junit .Assert .assertArrayEquals ;
17- import static org .junit .Assert .assertEquals ;
18- import static org .junit .Assert .assertNotNull ;
19- import static org .junit .Assert .assertTrue ;
20- import static org .junit .Assert .fail ;
16+ import static org .junit .jupiter . api . Assertions .assertArrayEquals ;
17+ import static org .junit .jupiter . api . Assertions .assertEquals ;
18+ import static org .junit .jupiter . api . Assertions .assertNotNull ;
19+ import static org .junit .jupiter . api . Assertions .assertTrue ;
20+ import static org .junit .jupiter . api . Assertions .fail ;
2121
2222import java .util .Random ;
2323import java .util .concurrent .atomic .AtomicBoolean ;
4545import org .eclipse .swt .widgets .Display ;
4646import org .eclipse .swt .widgets .Event ;
4747import org .eclipse .swt .widgets .Shell ;
48- import org .junit .After ;
49- import org .junit .Before ;
50- import org .junit .Test ;
48+ import org .junit .jupiter . api . AfterEach ;
49+ import org .junit .jupiter . api . BeforeEach ;
50+ import org .junit .jupiter . api . Test ;
5151
5252/**
5353 * Some simple tests for drag and drop.
@@ -64,7 +64,7 @@ public class Test_org_eclipse_swt_dnd_DND {
6464
6565private Shell shell ;
6666
67- @ Before
67+ @ BeforeEach
6868public void setUp () {
6969 shell = new Shell ();
7070 shell .setLayout (new RowLayout ());
@@ -75,10 +75,10 @@ public void setUp() {
7575 } catch (InterruptedException e ) {
7676 fail ("Initialization interrupted" );
7777 }
78- assertTrue ("Shell not visible." , shell . isVisible () );
78+ assertTrue (shell . isVisible (), "Shell not visible." );
7979}
8080
81- @ After
81+ @ AfterEach
8282public void tearDown () {
8383 Display display = shell .getDisplay ();
8484 display .dispose ();
@@ -108,7 +108,7 @@ protected int[] getTypeIds() {
108108 return new int [] { TEST_ID };
109109 }
110110 }, drag );
111- assertArrayEquals ("Drop received other data as we dragged." , drag , drop );
111+ assertArrayEquals (drag , drop , "Drop received other data as we dragged." );
112112}
113113
114114/**
@@ -120,7 +120,7 @@ public void testFileTransfer() throws InterruptedException {
120120 final String [] drop ;
121121
122122 drop = testTransferRoundtrip (FileTransfer .getInstance (), drag );
123- assertArrayEquals ("Drop received other data as we dragged." , drag , drop );
123+ assertArrayEquals (drag , drop , "Drop received other data as we dragged." );
124124}
125125
126126/**
@@ -132,7 +132,7 @@ public void testHtmlTransfer() throws InterruptedException {
132132 final String drop ;
133133
134134 drop = testTransferRoundtrip (HTMLTransfer .getInstance (), drag );
135- assertEquals ("Drop received other data as we dragged." , drag , drop );
135+ assertEquals (drag , drop , "Drop received other data as we dragged." );
136136}
137137
138138/**
@@ -208,7 +208,7 @@ public void testRtfTransfer() throws InterruptedException {
208208 final String drop ;
209209
210210 drop = testTransferRoundtrip (RTFTransfer .getInstance (), drag );
211- assertEquals ("Drop received other data as we dragged." , drag , drop );
211+ assertEquals (drag , drop , "Drop received other data as we dragged." );
212212}
213213
214214/**
@@ -220,7 +220,7 @@ public void testTextTransfer() throws InterruptedException {
220220 final String drop ;
221221
222222 drop = testTransferRoundtrip (TextTransfer .getInstance (), drag );
223- assertEquals ("Drop received other data as we dragged." , drag , drop );
223+ assertEquals (drag , drop , "Drop received other data as we dragged." );
224224}
225225
226226/**
@@ -232,7 +232,7 @@ public void testUrlTransfer() throws InterruptedException {
232232 final String drop ;
233233
234234 drop = testTransferRoundtrip (URLTransfer .getInstance (), drag );
235- assertEquals ("Drop received other data as we dragged." , drag , drop );
235+ assertEquals (drag , drop , "Drop received other data as we dragged." );
236236}
237237
238238/**
@@ -267,28 +267,28 @@ private Image createTestImage() {
267267 */
268268// This method is necessary because ImageData has no custom equals method and the default one isn't sufficient.
269269private void assertImageDataEqualsIgoringAlphaInData (final ImageData expected , final ImageData actual ) {
270- assertNotNull ("expected data must not be null" , expected );
271- assertNotNull ("actual data must not be null" , actual );
270+ assertNotNull (expected , "expected data must not be null" );
271+ assertNotNull (actual , "actual data must not be null" );
272272 if (expected == actual ) {
273273 return ;
274274 }
275- assertEquals ("height of expected image is different from actual image" , expected . height , actual . height );
275+ assertEquals (expected . height , actual . height , "height of expected image is different from actual image" );
276276 // Alpha values are taken from alpha data, so ignore whether data depth is 24 or 32 bits
277277 int expectedNormalizedDepth = expected .depth == 32 ? 24 : expected .depth ;
278278 int actualNormalizedDepth = expected .depth == 32 ? 24 : expected .depth ;
279- assertEquals ("depth of image data to compare must be equal" , expectedNormalizedDepth , actualNormalizedDepth );
280- assertEquals ("width of expected image is different from actual image" , expected . width , actual . width );
279+ assertEquals (expectedNormalizedDepth , actualNormalizedDepth , "depth of image data to compare must be equal" );
280+ assertEquals (expected . width , actual . width , "width of expected image is different from actual image" );
281281
282282 for (int y = 0 ; y < expected .height ; y ++) {
283283 for (int x = 0 ; x < expected .width ; x ++) {
284284 // FIXME win32: dragged ALPHA=FF, dropped ALPHA=00, but other transparencyType
285285 // => alpha stored in ImageData.alphaData
286286 String expectedPixel = String .format ("0x%08X" , expected .getPixel (x , y ) >> (expected .depth == 32 ? 8 : 0 ));
287287 String actualPixel = String .format ("0x%08X" , actual .getPixel (x , y ) >> (actual .depth == 32 ? 8 : 0 ));
288- assertEquals ("actual pixel at x=" + x + " y=" + y + " is different from expected pixel" , expectedPixel , actualPixel );
288+ assertEquals (expectedPixel , actualPixel , "actual pixel at x=" + x + " y=" + y + " is different from expected pixel" );
289289 int expectedAlpha = expected .getAlpha (x , y );
290290 int actualAlpha = actual .getAlpha (x , y );
291- assertEquals ("actual pixel alpha at x=" + x + " y=" + y + " is different from expected pixel" , expectedAlpha , actualAlpha );
291+ assertEquals (expectedAlpha , actualAlpha , "actual pixel alpha at x=" + x + " y=" + y + " is different from expected pixel" );
292292 }
293293 }
294294}
@@ -327,8 +327,8 @@ private <T> T testTransferRoundtrip(Transfer transfer, T data) throws Interrupte
327327 SwtWin32TestUtil .processEvents (shell .getDisplay (), 2000 , dropped ::get );
328328 } while (!dropped .get () && --maxTries > 0 );
329329
330- assertTrue ("No drop received." , dropped . get () );
331- assertNotNull ("No data was dropped." , droppedData . get () );
330+ assertTrue (dropped . get (), "No drop received." );
331+ assertNotNull (droppedData . get (), "No data was dropped." );
332332
333333 return droppedData .get ();
334334}
@@ -341,7 +341,7 @@ private <T> T testTransferRoundtrip(Transfer transfer, T data) throws Interrupte
341341 */
342342private void postDragAndDropEvents () {
343343 shell .forceActive ();
344- assertTrue ("Test shell requires input focus." , shell . forceFocus () );
344+ assertTrue (shell . forceFocus (), "Test shell requires input focus." );
345345 Event event = new Event ();
346346 Point pt = shell .toDisplay (50 , 50 );
347347 event .x = pt .x ;
0 commit comments