3838import java .util .Collections ;
3939import java .util .List ;
4040
41+ import static org .junit .Assert .assertNotEquals ;
4142import static org .mockito .ArgumentMatchers .any ;
4243import static org .mockito .ArgumentMatchers .eq ;
4344import static org .mockito .Mockito .doAnswer ;
@@ -56,7 +57,6 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
5657 private int softButtonObject1Id = 1000 , softButtonObject2Id = 2000 ;
5758 private SoftButtonObject softButtonObject1 , softButtonObject2 ;
5859 private SoftButtonState softButtonState1 , softButtonState2 , softButtonState3 , softButtonState4 ;
59- private Taskmaster taskmaster ;
6060
6161
6262 @ Override
@@ -93,8 +93,8 @@ public Void answer(InvocationOnMock invocation) {
9393 WindowCapability windowCapability = new WindowCapability ();
9494 windowCapability .setSoftButtonCapabilities (Collections .singletonList (softButtonCapabilities ));
9595 DisplayCapability displayCapability = new DisplayCapability ();
96- displayCapability .setWindowCapabilities (Arrays . asList (windowCapability ));
97- List <DisplayCapability > capabilities = Arrays . asList (displayCapability );
96+ displayCapability .setWindowCapabilities (Collections . singletonList (windowCapability ));
97+ List <DisplayCapability > capabilities = Collections . singletonList (displayCapability );
9898 onSystemCapabilityListener .onCapabilityRetrieved (capabilities );
9999 return null ;
100100 }
@@ -119,7 +119,7 @@ public Void answer(InvocationOnMock invocation) {
119119
120120
121121 // Create softButtonManager
122- taskmaster = new Taskmaster .Builder ().build ();
122+ Taskmaster taskmaster = new Taskmaster .Builder ().build ();
123123 taskmaster .start ();
124124 when (internalInterface .getTaskmaster ()).thenReturn (taskmaster );
125125 softButtonManager = new SoftButtonManager (internalInterface , fileManager );
@@ -370,14 +370,14 @@ public void onEvent(SoftButtonObject softButtonObject, OnButtonEvent onButtonEve
370370 // Case 1: object is null, assertFalse
371371 softButtonObject1 = new SoftButtonObject ("test" , softButtonState1 , null );
372372 softButtonObject2 = null ;
373- assertFalse (softButtonObject1 . equals ( softButtonObject2 ) );
373+ assertNotEquals (softButtonObject1 , softButtonObject2 );
374374
375375 // Case 2 SoftButtonObjects are the same, assertTrue
376- assertTrue (softButtonObject1 . equals ( softButtonObject1 ) );
376+ assertEquals (softButtonObject1 , softButtonObject1 );
377377
378378 // Case 3: object is not an instance of SoftButtonObject assertFalse
379379 SdlArtwork artwork = new SdlArtwork ("image1" , FileType .GRAPHIC_PNG , 1 , true );
380- assertFalse (softButtonObject1 . equals ( artwork ) );
380+ assertNotEquals (softButtonObject1 , artwork );
381381
382382 // Case 4: SoftButtonObjectState List are not same size, assertFalse
383383 List <SoftButtonState > softButtonStateList = new ArrayList <>();
@@ -387,53 +387,53 @@ public void onEvent(SoftButtonObject softButtonObject, OnButtonEvent onButtonEve
387387 softButtonStateList2 .add (softButtonState2 );
388388 softButtonObject1 = new SoftButtonObject ("hi" , softButtonStateList , "Hi" , null );
389389 softButtonObject2 = new SoftButtonObject ("hi" , softButtonStateList2 , "Hi" , null );
390- assertFalse (softButtonObject1 . equals ( softButtonObject2 ) );
390+ assertNotEquals (softButtonObject1 , softButtonObject2 );
391391
392392 // Case 5: SoftButtonStates are not the same, assertFalse
393393 softButtonObject1 = new SoftButtonObject ("test" , softButtonState1 , null );
394394 softButtonObject2 = new SoftButtonObject ("test" , softButtonState2 , null );
395- assertFalse (softButtonObject1 . equals ( softButtonObject2 ) );
395+ assertNotEquals (softButtonObject1 , softButtonObject2 );
396396
397397 // Case 6: SoftButtonObject names are not same, assertFalse
398398 softButtonObject1 = new SoftButtonObject ("test" , softButtonState1 , null );
399399 softButtonObject2 = new SoftButtonObject ("test23123" , softButtonState1 , null );
400- assertFalse (softButtonObject1 . equals ( softButtonObject2 ) );
400+ assertNotEquals (softButtonObject1 , softButtonObject2 );
401401
402402 // Case 7: SoftButtonObject currentStateName not same, assertFalse
403403 softButtonObject1 = new SoftButtonObject ("hi" , softButtonStateList , "Hi" , null );
404404 softButtonObject2 = new SoftButtonObject ("hi" , softButtonStateList , "Hi2" , null );
405- assertFalse (softButtonObject1 . equals ( softButtonObject2 ) );
405+ assertNotEquals (softButtonObject1 , softButtonObject2 );
406406 }
407407
408408 /**
409409 * Test custom overridden softButtonState equals method
410410 */
411411 public void testSoftButtonStateEquals () {
412- assertFalse (softButtonState1 . equals ( softButtonState2 ) );
412+ assertNotEquals (softButtonState1 , softButtonState2 );
413413 SdlArtwork artwork1 = new SdlArtwork ("image1" , FileType .GRAPHIC_PNG , 1 , true );
414414 SdlArtwork artwork2 = new SdlArtwork ("image2" , FileType .GRAPHIC_PNG , 1 , true );
415415
416416 // Case 1: object is null, assertFalse
417417 softButtonState1 = new SoftButtonState ("object1-state1" , "o1s1" , artwork1 );
418418 softButtonState2 = null ;
419- assertFalse (softButtonState1 . equals ( softButtonState2 ) );
419+ assertNotEquals (softButtonState1 , softButtonState2 );
420420
421421 // Case 2 SoftButtonObjects are the same, assertTrue
422- assertTrue (softButtonState1 . equals ( softButtonState1 ) );
422+ assertEquals (softButtonState1 , softButtonState1 );
423423
424424 // Case 3: object is not an instance of SoftButtonState, assertFalse
425- assertFalse (softButtonState1 . equals ( artwork1 ) );
425+ assertNotEquals (softButtonState1 , artwork1 );
426426
427427 // Case 4: different artwork, assertFalse
428428 softButtonState2 = new SoftButtonState ("object1-state1" , "o1s1" , artwork2 );
429- assertFalse (softButtonState1 . equals ( softButtonState2 ) );
429+ assertNotEquals (softButtonState1 , softButtonState2 );
430430
431431 // Case 5: different name, assertFalse
432432 softButtonState2 = new SoftButtonState ("object1-state1 different name" , "o1s1" , artwork1 );
433- assertFalse (softButtonState1 . equals ( softButtonState2 ) );
433+ assertNotEquals (softButtonState1 , softButtonState2 );
434434
435435 // Case 6 they are equal, assertTrue
436436 softButtonState2 = new SoftButtonState ("object1-state1" , "o1s1" , artwork1 );
437- assertTrue (softButtonState1 . equals ( softButtonState2 ) );
437+ assertEquals (softButtonState1 , softButtonState2 );
438438 }
439439}
0 commit comments