diff options
author | NicoleYarroch <nicole@livio.io> | 2019-08-14 15:36:14 -0400 |
---|---|---|
committer | NicoleYarroch <nicole@livio.io> | 2019-08-14 15:36:14 -0400 |
commit | bc9c9753c244fec11250bd5a98c98db3013dd213 (patch) | |
tree | cd26df6af2996c9e1cec5e53bc5e1cc54dd369c0 | |
parent | 5896f02a27b6b9a0d11fe02298a6c641b1f1eb90 (diff) | |
download | sdl_android-bc9c9753c244fec11250bd5a98c98db3013dd213.tar.gz |
Refactored true/false checks in test cases
3 files changed, 23 insertions, 52 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java index 740644135..900336594 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java @@ -112,6 +112,6 @@ public class ChoiceSetTests extends AndroidTestCase2 { }; choiceSet.cancel(); - assertEquals(Test.MATCH, canceledHandlerCalled.booleanValue(), true); + assertTrue(canceledHandlerCalled); } } diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java index 273f7f23c..7bc2816e3 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java @@ -121,8 +121,6 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 { public void testCancelingChoiceSetSuccessfullyIfThreadIsRunning(){ presentChoiceSetOperation.run(); - assertEquals(presentChoiceSetOperation.isExecuting().booleanValue(), true); - assertEquals(presentChoiceSetOperation.isFinished().booleanValue(), false); Answer<Void> cancelInteractionAnswer = new Answer<Void>() { @Override @@ -144,14 +142,12 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 { choiceSet.cancel(); - assertEquals(presentChoiceSetOperation.isExecuting().booleanValue(), true); - assertEquals(presentChoiceSetOperation.isFinished().booleanValue(), false); + assertTrue(presentChoiceSetOperation.isExecuting()); + assertFalse(presentChoiceSetOperation.isFinished()); } public void testCancelingChoiceSetUnsuccessfullyIfThreadIsRunning(){ presentChoiceSetOperation.run(); - assertEquals(presentChoiceSetOperation.isExecuting().booleanValue(), true); - assertEquals(presentChoiceSetOperation.isFinished().booleanValue(), false); Answer<Void> cancelInteractionAnswer = new Answer<Void>() { @Override @@ -173,29 +169,23 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 { choiceSet.cancel(); - assertEquals(presentChoiceSetOperation.isExecuting().booleanValue(), true); - assertEquals(presentChoiceSetOperation.isFinished().booleanValue(), false); + assertTrue(presentChoiceSetOperation.isExecuting()); + assertFalse(presentChoiceSetOperation.isFinished()); } public void testCancelingChoiceSetIfThreadHasFinished(){ presentChoiceSetOperation.run(); presentChoiceSetOperation.finishOperation(); - assertEquals(presentChoiceSetOperation.isExecuting().booleanValue(), false); - assertEquals(presentChoiceSetOperation.isFinished().booleanValue(), true); - choiceSet.cancel(); verify(internalInterface, never()).sendRPC(any(CancelInteraction.class)); - assertEquals(presentChoiceSetOperation.isExecuting().booleanValue(), false); - assertEquals(presentChoiceSetOperation.isFinished().booleanValue(), true); + assertFalse(presentChoiceSetOperation.isExecuting()); + assertTrue(presentChoiceSetOperation.isFinished()); } public void testCancelingChoiceSetIfThreadHasNotYetRun(){ - assertEquals(presentChoiceSetOperation.isExecuting().booleanValue(), false); - assertEquals(presentChoiceSetOperation.isFinished().booleanValue(), false); - choiceSet.cancel(); verify(internalInterface, never()).sendRPC(any(CancelInteraction.class)); @@ -207,8 +197,8 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 { verify(internalInterface, never()).sendRPC(any(CancelInteraction.class)); verify(internalInterface, never()).sendRPC(any(PerformInteraction.class)); - assertEquals(presentChoiceSetOperation.isExecuting().booleanValue(), false); - assertEquals(presentChoiceSetOperation.isFinished().booleanValue(), true); + assertFalse(presentChoiceSetOperation.isExecuting()); + assertTrue(presentChoiceSetOperation.isFinished()); } public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeature(){ @@ -216,9 +206,6 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 { presentChoiceSetOperation.sdlMsgVersion = new SdlMsgVersion(5, 3); presentChoiceSetOperation.run(); - assertEquals(presentChoiceSetOperation.isExecuting().booleanValue(), true); - assertEquals(presentChoiceSetOperation.isFinished().booleanValue(), false); - choiceSet.cancel(); verify(internalInterface, never()).sendRPC(any(CancelInteraction.class)); @@ -228,9 +215,6 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 { // Only supported with RPC spec versions 6.0.0+ presentChoiceSetOperation.sdlMsgVersion = new SdlMsgVersion(5, 3); - assertEquals(presentChoiceSetOperation.isExecuting().booleanValue(), false); - assertEquals(presentChoiceSetOperation.isFinished().booleanValue(), false); - choiceSet.cancel(); verify(internalInterface, never()).sendRPC(any(CancelInteraction.class)); @@ -242,7 +226,7 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 { verify(internalInterface, never()).sendRPC(any(CancelInteraction.class)); verify(internalInterface, never()).sendRPC(any(PerformInteraction.class)); - assertEquals(presentChoiceSetOperation.isExecuting().booleanValue(), false); - assertEquals(presentChoiceSetOperation.isFinished().booleanValue(), true); + assertFalse(presentChoiceSetOperation.isExecuting()); + assertTrue(presentChoiceSetOperation.isFinished()); } } diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java index 336c6ac9f..072fa3f43 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java @@ -116,8 +116,6 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 { public void testCancelingKeyboardSuccessfullyIfThreadIsRunning(){ presentKeyboardOperation.run(); - assertEquals(presentKeyboardOperation.isExecuting().booleanValue(), true); - assertEquals(presentKeyboardOperation.isFinished().booleanValue(), false); Answer<Void> cancelInteractionAnswer = new Answer<Void>() { @Override @@ -139,14 +137,12 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 { presentKeyboardOperation.dismissKeyboard(); - assertEquals(presentKeyboardOperation.isExecuting().booleanValue(), true); - assertEquals(presentKeyboardOperation.isFinished().booleanValue(), false); + assertTrue(presentKeyboardOperation.isExecuting()); + assertFalse(presentKeyboardOperation.isFinished()); } public void testCancelingKeyboardUnsuccessfullyIfThreadIsRunning(){ presentKeyboardOperation.run(); - assertEquals(presentKeyboardOperation.isExecuting().booleanValue(), true); - assertEquals(presentKeyboardOperation.isFinished().booleanValue(), false); Answer<Void> cancelInteractionAnswer = new Answer<Void>() { @Override @@ -168,37 +164,31 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 { presentKeyboardOperation.dismissKeyboard(); - assertEquals(presentKeyboardOperation.isExecuting().booleanValue(), true); - assertEquals(presentKeyboardOperation.isFinished().booleanValue(), false); + assertTrue(presentKeyboardOperation.isExecuting()); + assertFalse(presentKeyboardOperation.isFinished()); } public void testCancelingKeyboardIfThreadHasFinished(){ presentKeyboardOperation.run(); presentKeyboardOperation.finishOperation(); - assertEquals(presentKeyboardOperation.isExecuting().booleanValue(), false); - assertEquals(presentKeyboardOperation.isFinished().booleanValue(), true); - presentKeyboardOperation.dismissKeyboard(); verify(internalInterface, never()).sendRPC(any(CancelInteraction.class)); - assertEquals(presentKeyboardOperation.isExecuting().booleanValue(), false); - assertEquals(presentKeyboardOperation.isFinished().booleanValue(), true); + assertFalse(presentKeyboardOperation.isExecuting()); + assertTrue(presentKeyboardOperation.isFinished()); } public void testCancelingKeyboardIfThreadHasNotYetRun(){ - assertEquals(presentKeyboardOperation.isExecuting().booleanValue(), false); - assertEquals(presentKeyboardOperation.isFinished().booleanValue(), false); - presentKeyboardOperation.dismissKeyboard(); // Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is sent verify(internalInterface, never()).sendRPC(any(CancelInteraction.class)); verify(internalInterface, never()).sendRPC(any(PerformInteraction.class)); - assertEquals(presentKeyboardOperation.isExecuting().booleanValue(), false); - assertEquals(presentKeyboardOperation.isFinished().booleanValue(), false); + assertFalse(presentKeyboardOperation.isExecuting()); + assertFalse(presentKeyboardOperation.isFinished()); } public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeature(){ @@ -206,8 +196,8 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 { presentKeyboardOperation.sdlMsgVersion = new SdlMsgVersion(5, 3); presentKeyboardOperation.run(); - assertEquals(presentKeyboardOperation.isExecuting().booleanValue(), true); - assertEquals(presentKeyboardOperation.isFinished().booleanValue(), false); + assertTrue(presentKeyboardOperation.isExecuting()); + assertFalse(presentKeyboardOperation.isFinished()); presentKeyboardOperation.dismissKeyboard(); @@ -218,9 +208,6 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 { // Only supported with RPC spec versions 6.0.0+ presentKeyboardOperation.sdlMsgVersion = new SdlMsgVersion(5, 3); - assertEquals(presentKeyboardOperation.isExecuting().booleanValue(), false); - assertEquals(presentKeyboardOperation.isFinished().booleanValue(), false); - presentKeyboardOperation.dismissKeyboard(); verify(internalInterface, never()).sendRPC(any(CancelInteraction.class)); @@ -232,7 +219,7 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 { verify(internalInterface, never()).sendRPC(any(CancelInteraction.class)); verify(internalInterface, never()).sendRPC(any(PerformInteraction.class)); - assertEquals(presentKeyboardOperation.isExecuting().booleanValue(), false); - assertEquals(presentKeyboardOperation.isFinished().booleanValue(), true); + assertFalse(presentKeyboardOperation.isExecuting()); + assertTrue(presentKeyboardOperation.isFinished()); } } |