summaryrefslogtreecommitdiff
path: root/android/sdl_android
diff options
context:
space:
mode:
Diffstat (limited to 'android/sdl_android')
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java23
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java30
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java33
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetLayoutTests.java17
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java33
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java29
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java38
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java19
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java25
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java31
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java15
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java30
25 files changed, 424 insertions, 221 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java
index d3fbe2ef7..1c6eb9d34 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java
@@ -1,22 +1,29 @@
package com.smartdevicelink.managers.lockscreen;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.test.TestValues;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertTrue;
+
/**
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link com.smartdevicelink.managers.lockscreen.LockScreenConfig}
*
* We currently do not need to test null values, as each currently is a primitive
*/
-public class LockScreenConfigTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class LockScreenConfigTests {
private LockScreenConfig lockScreenConfig;
- @Override
+ @Before
public void setUp() throws Exception {
- super.setUp();
-
// set info for all the setters
lockScreenConfig = new LockScreenConfig();
lockScreenConfig.setCustomView(TestValues.GENERAL_INT);
@@ -27,11 +34,7 @@ public class LockScreenConfigTests extends AndroidTestCase2 {
lockScreenConfig.setDisplayMode(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testLockScreenConfig() {
// get the info and make sure its correct
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java
index 796f900d3..290515d54 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java
@@ -3,21 +3,13 @@ package com.smartdevicelink.managers.lockscreen;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.util.AndroidTools;
-
-import org.json.JSONException;
-import org.json.JSONObject;
+import org.junit.Test;
import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
import org.mockito.Mockito;
-import java.io.File;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
@@ -25,7 +17,8 @@ import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-public class LockScreenDeviceIconManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class LockScreenDeviceIconManagerTests {
TemporaryFolder tempFolder = new TemporaryFolder();
private LockScreenDeviceIconManager lockScreenDeviceIconManager;
@@ -33,14 +26,7 @@ public class LockScreenDeviceIconManagerTests extends AndroidTestCase2 {
private static final String LAST_UPDATED_TIME = "lastUpdatedTime";
private static final String STORED_PATH = "storedPath";
- public void setup() throws Exception {
- super.setUp();
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testRetrieveIconShouldCallOnErrorTwiceWhenGivenURLThatCannotDownloadAndIconIsNotCached() {
final SharedPreferences sharedPrefs = Mockito.mock(SharedPreferences.class);
final Context context = Mockito.mock(Context.class);
@@ -54,6 +40,7 @@ public class LockScreenDeviceIconManagerTests extends AndroidTestCase2 {
verify(listener, times(2)).onError(anyString());
}
+ @Test
public void testRetrieveIconShouldCallOnImageOnImageRetrievedWithIconWhenIconUpdateTimeIsNullFromSharedPref() {
final SharedPreferences sharedPrefs = Mockito.mock(SharedPreferences.class);
final Context context = Mockito.mock(Context.class);
@@ -67,7 +54,7 @@ public class LockScreenDeviceIconManagerTests extends AndroidTestCase2 {
verify(listener, times(1)).onImageRetrieved((Bitmap) any());
}
-
+ @Test
public void testRetrieveIconShouldCallOnImageOnImageRetrievedWithIconWhenCachedIconExpired() {
final SharedPreferences sharedPrefs = Mockito.mock(SharedPreferences.class);
final Context context = Mockito.mock(Context.class);
@@ -81,6 +68,7 @@ public class LockScreenDeviceIconManagerTests extends AndroidTestCase2 {
verify(listener, times(1)).onImageRetrieved((Bitmap) any());
}
+ @Test
public void testRetrieveIconShouldCallOnImageRetrievedWithIconWhenCachedIconIsUpToDate() {
final SharedPreferences sharedPrefs = Mockito.mock(SharedPreferences.class);
final Context context = Mockito.mock(Context.class);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java
index 29d324304..e6e86261b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java
@@ -1,8 +1,8 @@
package com.smartdevicelink.managers.lockscreen;
import android.content.Context;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.OnDriverDistraction;
@@ -12,9 +12,17 @@ import com.smartdevicelink.proxy.rpc.enums.LockScreenStatus;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.test.TestValues;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
+import static android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
@@ -24,14 +32,14 @@ import static org.mockito.Mockito.mock;
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link com.smartdevicelink.managers.lockscreen.LockScreenManager}
*/
-public class LockScreenManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class LockScreenManagerTests {
private LockScreenManager lockScreenManager;
private OnRPCNotificationListener onDDListener;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
ISdl internalInterface = mock(ISdl.class);
@@ -58,11 +66,7 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
lockScreenManager = new LockScreenManager(lockScreenConfig, context, internalInterface);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testVariables() {
assertEquals(TestValues.GENERAL_INT, lockScreenManager.customView);
assertEquals(TestValues.GENERAL_INT, lockScreenManager.lockScreenIcon);
@@ -73,48 +77,56 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
assertEquals(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED, lockScreenManager.displayMode);
}
+ @Test
public void testGetLockScreenStatusHmiNoneDDOff(){
lockScreenManager.driverDistStatus = false;
lockScreenManager.hmiLevel = HMILevel.HMI_NONE;
assertEquals(LockScreenStatus.OFF, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testGetLockScreenStatusHmiBackgroundDDOff(){
lockScreenManager.driverDistStatus = false;
lockScreenManager.hmiLevel = HMILevel.HMI_BACKGROUND;
assertEquals(LockScreenStatus.OFF, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testGetLockScreenStatusHmiNoneDDOn(){
lockScreenManager.driverDistStatus = true;
lockScreenManager.hmiLevel = HMILevel.HMI_BACKGROUND;
assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testGetLockScreenStatusHmiFullDDOff(){
lockScreenManager.driverDistStatus = false;
lockScreenManager.hmiLevel = HMILevel.HMI_FULL;
assertEquals(LockScreenStatus.OPTIONAL, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testGetLockScreenStatusHmiFullDDOn(){
lockScreenManager.driverDistStatus = true;
lockScreenManager.hmiLevel = HMILevel.HMI_FULL;
assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testGetLockScreenStatusHmiLimitedDDOff(){
lockScreenManager.driverDistStatus = false;
lockScreenManager.hmiLevel = HMILevel.HMI_LIMITED;
assertEquals(LockScreenStatus.OPTIONAL, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testGetLockScreenStatusHmiLimitedDDOn(){
lockScreenManager.driverDistStatus = true;
lockScreenManager.hmiLevel = HMILevel.HMI_LIMITED;
assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testLockScreenDismissibleWithEnableTrueAndDismissibilityTrue(){
lockScreenManager.enableDismissGesture = true;
OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
@@ -125,6 +137,7 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
assertTrue(lockScreenManager.mIsLockscreenDismissible);
}
+ @Test
public void testLockScreenDismissibleWithEnableFalseAndDismissibilityFalse(){
lockScreenManager.enableDismissGesture = false;
OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
@@ -135,6 +148,7 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
assertFalse(lockScreenManager.mIsLockscreenDismissible);
}
+ @Test
public void testLockScreenDismissibleWithEnableTrueAndDismissibilityFalse(){
lockScreenManager.enableDismissGesture = true;
OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
@@ -145,6 +159,7 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
assertFalse(lockScreenManager.mIsLockscreenDismissible);
}
+ @Test
public void testLockScreenDismissibleWithEnableFalseAndDismissibilityTrue(){
lockScreenManager.enableDismissGesture = false;
OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java
index deb5061dc..81354dd2c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java
@@ -1,8 +1,8 @@
package com.smartdevicelink.managers.permission;
import android.support.annotation.NonNull;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.HMIPermissions;
@@ -13,6 +13,9 @@ import com.smartdevicelink.proxy.rpc.PermissionItem;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -22,25 +25,26 @@ import java.util.List;
import java.util.Map;
import static com.smartdevicelink.managers.permission.BasePermissionManager.PERMISSION_GROUP_STATUS_DISALLOWED;
-import static com.smartdevicelink.managers.permission.BasePermissionManager.PERMISSION_GROUP_STATUS_UNKNOWN;
import static com.smartdevicelink.managers.permission.PermissionManager.PERMISSION_GROUP_STATUS_ALLOWED;
import static com.smartdevicelink.managers.permission.PermissionManager.PERMISSION_GROUP_STATUS_MIXED;
+import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
-public class PermissionManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class PermissionManagerTests {
private OnRPCNotificationListener onHMIStatusListener, onPermissionsChangeListener;
private PermissionManager permissionManager;
private int listenerCalledCounter;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
// Mock Isdl and its behaviour to use it for PermissionManager testing
@@ -98,6 +102,7 @@ public class PermissionManagerTests extends AndroidTestCase2 {
}
// Test adding a listener to be called when ALL of the specified permissions become allowed
+ @Test
public void testListenersAllAllowed() {
listenerCalledCounter = 0;
@@ -149,6 +154,7 @@ public class PermissionManagerTests extends AndroidTestCase2 {
// Test adding a listener to be called when ANY of the specified permissions become allowed
+ @Test
public void testListenersAnyAllowed() {
listenerCalledCounter = 0;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
index 7203b64b1..e19f10980 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
@@ -1,6 +1,7 @@
package com.smartdevicelink.managers.screen;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
@@ -11,22 +12,30 @@ import com.smartdevicelink.proxy.rpc.enums.MetadataType;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.test.TestValues;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Arrays;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.Mockito.mock;
/**
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link ScreenManager}
*/
-public class ScreenManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class ScreenManagerTests {
private ScreenManager screenManager;
private SdlArtwork testArtwork;
- @Override
+ @Before
public void setUp() throws Exception {
- super.setUp();
ISdl internalInterface = mock(ISdl.class);
FileManager fileManager = mock(FileManager.class);
@@ -35,11 +44,7 @@ public class ScreenManagerTests extends AndroidTestCase2 {
testArtwork = new SdlArtwork("testFile", FileType.GRAPHIC_PNG, 1, false);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testInstantiation(){
assertNull(screenManager.getTextField1());
assertNull(screenManager.getTextField2());
@@ -63,7 +68,8 @@ public class ScreenManagerTests extends AndroidTestCase2 {
assertEquals(screenManager.getState(), BaseSubManager.READY);
assertNull(screenManager.getMenuConfiguration());
}
-
+
+ @Test
public void testSetTextField() {
screenManager.setTextField1("It is");
screenManager.setTextField2("Wednesday");
@@ -77,39 +83,46 @@ public class ScreenManagerTests extends AndroidTestCase2 {
assertEquals(screenManager.getTitle(), "title");
}
+ @Test
public void testMediaTrackTextFields() {
String songTitle = "Wild For The Night";
screenManager.setMediaTrackTextField(songTitle);
assertEquals(screenManager.getMediaTrackTextField(), songTitle);
}
+ @Test
public void testSetPrimaryGraphic() {
screenManager.setPrimaryGraphic(testArtwork);
assertEquals(screenManager.getPrimaryGraphic(), testArtwork);
}
+ @Test
public void testSetPrimaryGraphicWithBlankImage() {
screenManager.setPrimaryGraphic(null);
assertNotNull(screenManager.getPrimaryGraphic());
assertEquals(screenManager.getPrimaryGraphic().getName(), "blankArtwork");
}
+ @Test
public void testSetSecondaryGraphic() {
screenManager.setSecondaryGraphic(testArtwork);
assertEquals(screenManager.getSecondaryGraphic(), testArtwork);
}
+ @Test
public void testSetSecondaryGraphicWithBlankImage() {
screenManager.setSecondaryGraphic(null);
assertNotNull(screenManager.getSecondaryGraphic());
assertEquals(screenManager.getSecondaryGraphic().getName(), "blankArtwork");
}
+ @Test
public void testAlignment() {
screenManager.setTextAlignment(TextAlignment.LEFT_ALIGNED);
assertEquals(screenManager.getTextAlignment(), TextAlignment.LEFT_ALIGNED);
}
+ @Test
public void testSetTextFieldTypes() {
screenManager.setTextField1Type(MetadataType.MEDIA_TITLE);
screenManager.setTextField2Type(MetadataType.MEDIA_ALBUM);
@@ -121,6 +134,7 @@ public class ScreenManagerTests extends AndroidTestCase2 {
assertEquals(screenManager.getTextField4Type(), MetadataType.MEDIA_GENRE);
}
+ @Test
public void testSetMenuManagerFields(){
screenManager.setDynamicMenuUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
screenManager.setMenu(TestValues.GENERAL_MENUCELL_LIST);
@@ -132,11 +146,13 @@ public class ScreenManagerTests extends AndroidTestCase2 {
assertNull(screenManager.getMenuConfiguration());
}
+ @Test
public void testSetVoiceCommands(){
screenManager.setVoiceCommands(TestValues.GENERAL_VOICE_COMMAND_LIST);
assertEquals(screenManager.getVoiceCommands(), TestValues.GENERAL_VOICE_COMMAND_LIST);
}
+ @Test
public void testSetSoftButtonObjects(){
// Create softButtonObject1
SoftButtonState softButtonState1 = new SoftButtonState("object1-state1", "it is", testArtwork);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java
index 93688f570..fd5b1a71a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java
@@ -1,7 +1,8 @@
package com.smartdevicelink.managers.screen;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.MultipleFileCompletionListener;
@@ -24,6 +25,9 @@ import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.test.Validator;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -32,6 +36,10 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
@@ -41,7 +49,8 @@ import static org.mockito.Mockito.mock;
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link SoftButtonManager}
*/
-public class SoftButtonManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class SoftButtonManagerTests {
private SoftButtonManager softButtonManager;
private boolean fileManagerUploadArtworksGotCalled;
@@ -52,9 +61,8 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
private SoftButtonState softButtonState1, softButtonState2, softButtonState3, softButtonState4;
- @Override
+ @Before
public void setUp() throws Exception {
- super.setUp();
// When internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, OnRPCNotificationListener) is called
// inside SoftButtonManager, respond with a fake HMILevel.HMI_FULL response to let the SoftButtonManager continue working.
@@ -125,11 +133,7 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
softButtonObject2.setButtonId(softButtonObject2Id);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testSoftButtonManagerUpdate() {
// Reset the boolean variables
fileManagerUploadArtworksGotCalled = false;
@@ -172,6 +176,7 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
assertEquals("Returned softButtonObjects value doesn't match the expected value", softButtonObjects, softButtonManager.getSoftButtonObjects());
}
+ @Test
public void testSoftButtonManagerGetSoftButtonObject() {
softButtonManager.setSoftButtonObjects(Arrays.asList(softButtonObject1, softButtonObject2));
@@ -192,6 +197,7 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
assertNull("Returned SoftButtonObject doesn't match the expected value", softButtonManager.getSoftButtonObjectById(5555));
}
+ @Test
public void testSoftButtonState(){
// Test SoftButtonState.getName()
String nameExpectedValue = "object1-state1";
@@ -213,6 +219,7 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
assertTrue("Returned SoftButton doesn't match the expected value", Validator.validateSoftButton(softButtonExpectedValue, softButtonState1.getSoftButton()));
}
+ @Test
public void testSoftButtonObject(){
// Test SoftButtonObject.getName()
assertEquals("Returned object name doesn't match the expected value", "object1", softButtonObject1.getName());
@@ -257,6 +264,7 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
assertEquals(softButtonState1, softButtonObject1.getCurrentState());
}
+ @Test
public void testAssigningIdsToSoftButtonObjects() {
SoftButtonObject sbo1, sbo2, sbo3, sbo4, sbo5;
@@ -312,6 +320,7 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
/**
* Test custom overridden softButtonObject equals method
*/
+ @Test
public void testSoftButtonObjectEquals() {
SoftButtonObject softButtonObject1;
SoftButtonObject softButtonObject2;
@@ -377,6 +386,7 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
/**
* Test custom overridden softButtonState equals method
*/
+ @Test
public void testSoftButtonStateEquals() {
assertFalse(softButtonState1.equals(softButtonState2));
SdlArtwork artwork1 = new SdlArtwork("image1", FileType.GRAPHIC_PNG, 1, true);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
index 8aa9ae8a8..6d9315348 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
@@ -2,8 +2,8 @@ package com.smartdevicelink.managers.screen;
import android.content.Context;
import android.net.Uri;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.ManagerUtility;
import com.smartdevicelink.managers.file.FileManager;
@@ -20,27 +20,35 @@ import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
import org.json.JSONException;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import static android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
import static org.mockito.Mockito.mock;
/**
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link com.smartdevicelink.managers.screen.TextAndGraphicManager}
*/
-public class TextAndGraphicManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class TextAndGraphicManagerTests {
// SETUP / HELPERS
private TextAndGraphicManager textAndGraphicManager;
private SdlArtwork testArtwork;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
- Context mTestContext = this.getContext();
+ Context mTestContext = getContext();
// mock things
ISdl internalInterface = mock(ISdl.class);
FileManager fileManager = mock(FileManager.class);
@@ -55,10 +63,6 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
textAndGraphicManager = new TextAndGraphicManager(internalInterface, fileManager, softButtonManager);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
private WindowCapability getWindowCapability(int numberOfMainFields){
@@ -102,6 +106,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
return windowCapability;
}
+ @Test
public void testInstantiation(){
assertNull(textAndGraphicManager.getTextField1());
@@ -132,6 +137,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
/**
* Test getting number of lines available to be set based off of windowCapability
*/
+ @Test
public void testGetMainLines(){
// We want to test that the looping works. By default, it will return 4 if display cap is null
@@ -146,6 +152,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(textAndGraphicManager.defaultMainWindowCapability), 3);
}
+ @Test
public void testAssemble1Line(){
Show inputShow = new Show();
@@ -196,6 +203,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(assembledShow.getMainField1(), "Wednesday - Dudes");
}
+ @Test
public void testAssemble2Lines() {
Show inputShow = new Show();
@@ -293,6 +301,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(tags.getMainField2(), tagsList2);
}
+ @Test
public void testAssemble3Lines() {
Show inputShow = new Show();
@@ -386,6 +395,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(assembledShow.getMainField3(), "My - Dudes");
}
+ @Test
public void testAssemble4Lines() {
Show inputShow = new Show();
@@ -519,6 +529,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
/**
* Testing if WindowCapability is null, TextFields should still update.
*/
+ @Test
public void testAssemble4LinesNullWindowCapability() {
Show inputShow = new Show();
@@ -629,6 +640,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(tags.getMainField4(), tagsList4);
}
+ @Test
public void testMediaTrackTextField() {
String songTitle = "Wild For The Night";
@@ -636,6 +648,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(textAndGraphicManager.getMediaTrackTextField(), songTitle);
}
+ @Test
public void testTemplateTitle() {
String title = "template title";
@@ -643,12 +656,14 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(textAndGraphicManager.getTitle(), title);
}
+ @Test
public void testAlignment() {
textAndGraphicManager.setTextAlignment(TextAlignment.LEFT_ALIGNED);
assertEquals(textAndGraphicManager.getTextAlignment(), TextAlignment.LEFT_ALIGNED);
}
+ @Test
public void testExtractTextFromShow(){
Show mainShow = new Show();
@@ -666,11 +681,13 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
// TEST IMAGES
+ @Test
public void testSetPrimaryGraphic() {
textAndGraphicManager.setPrimaryGraphic(testArtwork);
assertEquals(textAndGraphicManager.getPrimaryGraphic(), testArtwork);
}
+ @Test
public void testSetSecondaryGraphic() {
textAndGraphicManager.setSecondaryGraphic(testArtwork);
assertEquals(textAndGraphicManager.getSecondaryGraphic(), testArtwork);
@@ -678,6 +695,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
// TEST DISPOSE
+ @Test
public void testDispose() {
textAndGraphicManager.dispose();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java
index 7b9696151..cba4ee77d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java
@@ -35,32 +35,36 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.Choice;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSet;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSet;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
import static org.mockito.Mockito.mock;
-public class CheckChoiceVROptionalOperationTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class CheckChoiceVROptionalOperationTests {
private CheckChoiceVROptionalOperation checkChoiceVROptionalOperation;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
ISdl internalInterface = mock(ISdl.class);
CheckChoiceVROptionalInterface checkChoiceVROptionalInterface = mock(CheckChoiceVROptionalInterface.class);
checkChoiceVROptionalOperation = new CheckChoiceVROptionalOperation(internalInterface, checkChoiceVROptionalInterface);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testCreateChoiceNoVR(){
CreateInteractionChoiceSet setNoVR = checkChoiceVROptionalOperation.testCellWithVR(false);
assertNotNull(setNoVR);
@@ -69,6 +73,7 @@ public class CheckChoiceVROptionalOperationTests extends AndroidTestCase2 {
assertNull(choice.getVrCommands());
}
+ @Test
public void testCreateChoiceWithVR(){
CreateInteractionChoiceSet setNoVR = checkChoiceVROptionalOperation.testCellWithVR(true);
assertNotNull(setNoVR);
@@ -77,6 +82,7 @@ public class CheckChoiceVROptionalOperationTests extends AndroidTestCase2 {
assertEquals(choice.getVrCommands().get(0), "Test VR");
}
+ @Test
public void testDeleteInteractionChoiceSet(){
DeleteInteractionChoiceSet deleteSet = checkChoiceVROptionalOperation.createDeleteInteractionChoiceSet();
assertNotNull(deleteSet);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java
index 2c401e04e..8f1c4f5c1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java
@@ -32,26 +32,26 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.test.TestValues;
-public class ChoiceCellTests extends AndroidTestCase2 {
+import org.junit.Test;
+import org.junit.runner.RunWith;
- private static final int MAX_ID = 2000000000;
- private SdlArtwork artwork = new SdlArtwork("image", FileType.GRAPHIC_PNG, 1, true);
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertTrue;
- @Override
- public void setUp() throws Exception{
- super.setUp();
- }
+@RunWith(AndroidJUnit4.class)
+public class ChoiceCellTests {
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
+ private static final int MAX_ID = 2000000000;
+ private SdlArtwork artwork = new SdlArtwork("image", FileType.GRAPHIC_PNG, 1, true);
+ @Test
public void testSettersAndGetters(){
// set everything
@@ -72,6 +72,7 @@ public class ChoiceCellTests extends AndroidTestCase2 {
assertEquals(choiceCell.getChoiceId(), MAX_ID);
}
+ @Test
public void testConstructors() {
// first constructor was tested in previous method, use the rest here
@@ -98,6 +99,7 @@ public class ChoiceCellTests extends AndroidTestCase2 {
assertEquals(choiceCell.getChoiceId(), MAX_ID);
}
+ @Test
public void testCellEquality(){
ChoiceCell choiceCell = new ChoiceCell(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING_LIST, artwork);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetLayoutTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetLayoutTests.java
index 3f147f128..854fc61f7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetLayoutTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetLayoutTests.java
@@ -32,16 +32,26 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-public class ChoiceSetLayoutTests extends AndroidTestCase2 {
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
+import static junit.framework.TestCase.fail;
+
+@RunWith(AndroidJUnit4.class)
+public class ChoiceSetLayoutTests {
/**
* Verifies that the enum values are not null upon valid assignment.
*/
+ @Test
public void testValidEnums() {
ChoiceSetLayout choiceSetLayoutList = ChoiceSetLayout.valueForString("CHOICE_SET_LAYOUT_LIST");
ChoiceSetLayout choiceSetLayoutTiles = ChoiceSetLayout.valueForString("CHOICE_SET_LAYOUT_TILES");
@@ -52,6 +62,7 @@ public class ChoiceSetLayoutTests extends AndroidTestCase2 {
/**
* Verifies that an invalid assignment is null.
*/
+ @Test
public void testInvalidEnum() {
String example = "deFaUlt";
try {
@@ -65,6 +76,7 @@ public class ChoiceSetLayoutTests extends AndroidTestCase2 {
/**
* Verifies that a null assignment is invalid.
*/
+ @Test
public void testNullEnum() {
String example = null;
try {
@@ -78,6 +90,7 @@ public class ChoiceSetLayoutTests extends AndroidTestCase2 {
/**
* Verifies the possible enum values of DynamicMenuUpdatesMode.
*/
+ @Test
public void testListEnum() {
List<ChoiceSetLayout> enumValueList = Arrays.asList(ChoiceSetLayout.values());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
index 1a9efffbe..f483ea3dd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
@@ -35,7 +35,8 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.proxy.interfaces.ISdl;
@@ -47,6 +48,11 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -54,6 +60,12 @@ import java.util.HashSet;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNotSame;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -61,13 +73,13 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-public class ChoiceSetManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class ChoiceSetManagerTests {
private ChoiceSetManager csm;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
ISdl internalInterface = mock(ISdl.class);
FileManager fileManager = mock(FileManager.class);
@@ -89,7 +101,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertNull(csm.pendingPresentOperation);
}
- @Override
+ @After
public void tearDown() throws Exception {
csm.dispose();
@@ -108,9 +120,9 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertEquals(csm.getState(), BaseSubManager.SHUTDOWN);
- super.tearDown();
}
+ @Test
public void testDefaultKeyboardConfiguration(){
KeyboardProperties properties = csm.defaultKeyboardConfiguration();
assertEquals(properties.getLanguage(), Language.EN_US);
@@ -118,6 +130,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertEquals(properties.getKeypressMode(), KeypressMode.RESEND_CURRENT_ENTRY);
}
+ @Test
public void testSetupChoiceSet(){
ChoiceSetSelectionListener choiceSetSelectionListener = new ChoiceSetSelectionListener() {
@@ -157,6 +170,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertTrue(csm.setUpChoiceSet(choiceSet5));
}
+ @Test
public void testFindIfPresent(){
ChoiceCell cell1 = new ChoiceCell("test");
@@ -170,6 +184,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertNull(csm.findIfPresent(cell3, cellSet));
}
+ @Test
public void testUpdateIdsOnChoices(){
ChoiceCell cell1 = new ChoiceCell("test");
@@ -190,6 +205,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertNotSame(cell3.getChoiceId(), 2000000000);
}
+ @Test
public void testChoicesToBeRemovedFromPendingWithArray(){
ChoiceCell cell1 = new ChoiceCell("test");
@@ -215,6 +231,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
}
}
+ @Test
public void testChoicesToBeUploadedWithArray(){
ChoiceCell cell1 = new ChoiceCell("test");
@@ -240,6 +257,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
}
}
+ @Test
public void testPresentingKeyboardShouldReturnCancelIDIfKeyboardCanBeSent() {
ISdl internalInterface = mock(ISdl.class);
FileManager fileManager = mock(FileManager.class);
@@ -252,6 +270,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertNotNull(cancelId);
}
+ @Test
public void testPresentingKeyboardShouldNotReturnCancelIDIfKeyboardCannotBeSent() {
ISdl internalInterface = mock(ISdl.class);
FileManager fileManager = mock(FileManager.class);
@@ -264,6 +283,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertNull(cancelId);
}
+ @Test
public void testDismissingExecutingKeyboard(){
Integer testCancelID = 42;
PresentKeyboardOperation testKeyboardOp = mock(PresentKeyboardOperation.class);
@@ -273,6 +293,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
verify(testKeyboardOp, times(1)).dismissKeyboard();
}
+ @Test
public void testDismissingQueuedKeyboard(){
Integer testCancelID = 42;
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 b20357a4b..c7cda00fb 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
@@ -32,15 +32,23 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.test.TestValues;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Arrays;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.Mockito.mock;
-public class ChoiceSetTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class ChoiceSetTests {
private ChoiceSetSelectionListener listener;
private ChoiceSetLayout layout;
@@ -48,9 +56,8 @@ public class ChoiceSetTests extends AndroidTestCase2 {
private Integer defaultTimeout;
private Boolean canceledHandlerCalled;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
listener = mock(ChoiceSetSelectionListener.class);
layout = ChoiceSetLayout.CHOICE_SET_LAYOUT_LIST;
@@ -59,11 +66,8 @@ public class ChoiceSetTests extends AndroidTestCase2 {
canceledHandlerCalled = false;
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
+ @Test
public void testSettersAndGetters(){
// test small constructor
@@ -77,6 +81,7 @@ public class ChoiceSetTests extends AndroidTestCase2 {
assertEquals(choiceSet.getChoiceSetSelectionListener(), listener);
}
+ @Test
public void testConstructors() {
// first constructor was tested in previous method, use the rest here
@@ -101,6 +106,7 @@ public class ChoiceSetTests extends AndroidTestCase2 {
assertEquals(choiceSet2.getChoiceSetSelectionListener(), listener);
}
+ @Test
public void testCancelingChoiceSet() {
ChoiceSet choiceSet = new ChoiceSet(TestValues.GENERAL_STRING, choices, listener);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java
index 67200d0fe..e2cdcf7ae 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java
@@ -35,22 +35,29 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSet;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.HashSet;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
import static org.mockito.Mockito.mock;
-public class DeleteChoicesOperationTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class DeleteChoicesOperationTests {
private DeleteChoicesOperation deleteChoicesOperation;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
ChoiceCell cell1 = new ChoiceCell("cell 1");
ChoiceCell cell2 = new ChoiceCell("cell 2");
@@ -62,11 +69,8 @@ public class DeleteChoicesOperationTests extends AndroidTestCase2 {
deleteChoicesOperation = new DeleteChoicesOperation(internalInterface, cellsToDelete, null);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
+ @Test
public void testCreateListDeleteInteractionSets(){
List<DeleteInteractionChoiceSet> deletes = deleteChoicesOperation.createDeleteSets();
assertNotNull(deletes);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java
index 9b20f1bc1..b8be6edc5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java
@@ -35,7 +35,8 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.proxy.interfaces.ISdl;
@@ -49,25 +50,32 @@ import com.smartdevicelink.proxy.rpc.enums.ImageType;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
import com.smartdevicelink.test.TestValues;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.Mockito.mock;
-public class PreloadChoicesOperationTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class PreloadChoicesOperationTests {
private PreloadChoicesOperation preloadChoicesOperation;
private PreloadChoicesOperation preloadChoicesOperationNullCapability;
private PreloadChoicesOperation preloadChoicesOperationEmptyCapability;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
-
ChoiceCell cell1 = new ChoiceCell("cell 1");
ChoiceCell cell2 = new ChoiceCell("cell 2", null, TestValues.GENERAL_ARTWORK);
HashSet<ChoiceCell> cellsToPreload = new HashSet<>();
@@ -140,16 +148,13 @@ public class PreloadChoicesOperationTests extends AndroidTestCase2 {
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testArtworkNeedsUpload(){
boolean test = preloadChoicesOperation.artworkNeedsUpload(TestValues.GENERAL_ARTWORK);
assertTrue(test);
}
+ @Test
public void testArtworksToUpload(){
List<SdlArtwork> artworksToUpload = preloadChoicesOperation.artworksToUpload();
assertNotNull(artworksToUpload);
@@ -159,6 +164,7 @@ public class PreloadChoicesOperationTests extends AndroidTestCase2 {
/**
* Testing shouldSend method's with varying WindowCapability set.
*/
+ @Test
public void testShouldSendText() {
setUpNullWindowCapability();
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 c0b3c32fa..8e2df6181 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
@@ -35,7 +35,8 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
@@ -50,6 +51,9 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
import com.smartdevicelink.test.TestValues;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -58,6 +62,10 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
@@ -66,7 +74,8 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class PresentChoiceSetOperationTests {
private PresentChoiceSetOperation presentChoiceSetOperation;
private ChoiceSet choiceSet;
@@ -76,9 +85,8 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
private ExecutorService executor;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
internalInterface = mock(ISdl.class);
@@ -92,10 +100,6 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
executor = Executors.newCachedThreadPool();
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
private KeyboardProperties getKeyBoardProperties(){
KeyboardProperties properties = new KeyboardProperties();
@@ -105,6 +109,7 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
return properties;
}
+ @Test
public void testGetLayoutMode(){
// First we will check knowing our keyboard listener is NOT NULL
presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
@@ -114,6 +119,7 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_ONLY);
}
+ @Test
public void testGetPerformInteraction(){
presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
@@ -127,6 +133,7 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_WITH_SEARCH);
}
+ @Test
public void testSetSelectedCellWithId(){
presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
@@ -135,6 +142,7 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
assertEquals(presentChoiceSetOperation.selectedCellRow, Integer.valueOf(0));
}
+ @Test
public void testCancelingChoiceSetSuccessfullyIfThreadIsRunning(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
@@ -175,6 +183,7 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
assertFalse(presentChoiceSetOperation.isCancelled());
}
+ @Test
public void testCancelingChoiceSetUnsuccessfullyIfThreadIsRunning(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
@@ -214,6 +223,7 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
assertFalse(presentChoiceSetOperation.isCancelled());
}
+ @Test
public void testCancelingChoiceSetIfThreadHasFinished(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
@@ -231,6 +241,7 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
assertFalse(presentChoiceSetOperation.isCancelled());
}
+ @Test
public void testCancelingChoiceSetIfThreadHasNotYetRun(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
@@ -256,6 +267,7 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
}
+ @Test
public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeature(){
// Cancel Interaction is only supported on RPC specs v.6.0.0+
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
@@ -275,6 +287,7 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
}
+ @Test
public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeatureButThreadIsNotRunning(){
// Cancel Interaction is only supported on RPC specs v.6.0.0+
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
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 109535c11..8316a79a5 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
@@ -35,7 +35,8 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
@@ -50,6 +51,9 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
import com.smartdevicelink.test.TestValues;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -57,6 +61,10 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
@@ -65,7 +73,8 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-public class PresentKeyboardOperationTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class PresentKeyboardOperationTests {
private PresentKeyboardOperation presentKeyboardOperation;
private KeyboardListener keyboardListener;
@@ -73,9 +82,8 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
private ExecutorService executor;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
internalInterface = mock(ISdl.class);
keyboardListener = mock(KeyboardListener.class);
@@ -98,11 +106,6 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
executor = Executors.newCachedThreadPool();
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
private KeyboardProperties getKeyBoardProperties(){
KeyboardProperties properties = new KeyboardProperties();
properties.setLanguage(Language.EN_US);
@@ -111,6 +114,7 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
return properties;
}
+ @Test
public void testGetPerformInteraction(){
presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, getKeyBoardProperties(), "Test", null, keyboardListener, TestValues.GENERAL_INTEGER);
@@ -123,6 +127,7 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
assertEquals(pi.getCancelID(), TestValues.GENERAL_INTEGER);
}
+ @Test
public void testCancelingKeyboardSuccessfullyIfThreadIsRunning(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
@@ -162,6 +167,7 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
assertFalse(presentKeyboardOperation.isCancelled());
}
+ @Test
public void testCancelingKeyboardUnsuccessfullyIfThreadIsRunning(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
@@ -197,6 +203,7 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
assertFalse(presentKeyboardOperation.isCancelled());
}
+ @Test
public void testCancelingKeyboardIfThreadHasFinished(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
@@ -214,6 +221,7 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
assertFalse(presentKeyboardOperation.isCancelled());
}
+ @Test
public void testCancelingKeyboardIfThreadHasNotYetRun(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
@@ -239,6 +247,7 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
}
+ @Test
public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeature(){
// Cancel Interaction is only supported on RPC specs v.6.0.0+
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
@@ -258,6 +267,7 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
}
+ @Test
public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeatureButThreadIsNotRunning(){
// Cancel Interaction is only supported on RPC specs v.6.0.0+
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java
index 14f178f89..e623d2ee2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java
@@ -35,22 +35,20 @@
package com.smartdevicelink.managers.screen.menu;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.test.TestValues;
-public class MenuConfigurationTests extends AndroidTestCase2 {
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import static junit.framework.TestCase.assertEquals;
- @Override
- public void setUp() throws Exception{
- super.setUp();
- }
+@RunWith(AndroidJUnit4.class)
+public class MenuConfigurationTests {
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
+ @Test
public void testSettersAndGetters(){
// set everything - we only use the constructor to set variables in the Menu Manager
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
index feca36cdf..4a68a6b1c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
@@ -32,7 +32,8 @@
package com.smartdevicelink.managers.screen.menu;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.R;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
@@ -54,15 +55,23 @@ import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
@@ -73,7 +82,8 @@ import static org.mockito.Mockito.verify;
/**
* the Algorithm specific tests are defined based on: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0210-mobile-dynamic-menu-cell-updating.md
*/
-public class MenuManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class MenuManagerTests {
private OnRPCNotificationListener onHMIStatusListener, commandListener;
private MenuManager menuManager;
@@ -82,9 +92,8 @@ public class MenuManagerTests extends AndroidTestCase2 {
// SETUP / HELPERS
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
cells = createTestCells();
@@ -148,7 +157,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
}
- @Override
+ @After
public void tearDown() throws Exception {
menuManager.dispose();
@@ -169,9 +178,9 @@ public class MenuManagerTests extends AndroidTestCase2 {
// after everything, make sure we are in the correct state
assertEquals(menuManager.getState(), BaseSubManager.SHUTDOWN);
- super.tearDown();
}
+ @Test
public void testStartMenuManager(){
menuManager.start(new CompletionListener() {
@@ -184,6 +193,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
});
}
+ @Test
public void testHMINotReady(){
menuManager.currentHMILevel = HMILevel.HMI_NONE;
@@ -202,6 +212,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertFalse(menuManager.waitingOnHMIUpdate);
}
+ @Test
public void testUpdatingOldWay(){
// Force Menu Manager to use the old way of deleting / sending all
@@ -247,6 +258,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
}
}
+ @Test
public void testAlgorithmTest1(){
// Force Menu Manager to use the new way
@@ -283,6 +295,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.keepsOld.size(), 4);
}
+ @Test
public void testAlgorithmTest2(){
// Force Menu Manager to use the new way
@@ -319,6 +332,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.keepsOld.size(), 3);
}
+ @Test
public void testAlgorithmTest3(){
// Force Menu Manager to use the new way
@@ -355,6 +369,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.keepsOld.size(), 0);
}
+ @Test
public void testAlgorithmTest4(){
// Force Menu Manager to use the new way
@@ -391,6 +406,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.keepsOld.size(), 2);
}
+ @Test
public void testAlgorithmTest5(){
// Force Menu Manager to use the new way
@@ -427,6 +443,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.keepsOld.size(), 3);
}
+ @Test
public void testSettingNullMenu(){
// Make sure we can send an empty menu with no issues
@@ -448,6 +465,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.menuCells.size(), 0);
}
+ @Test
public void testClearingMenu(){
// Make sure we can send an empty menu with no issues
@@ -469,6 +487,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.menuCells.size(), 0);
}
+ @Test
public void testOpeningMainMenu(){
// call open Menu
MenuManager mockMenuManager = mock(MenuManager.class);
@@ -476,6 +495,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
verify(mockMenuManager, Mockito.times(1)).openMenu();
}
+ @Test
public void testOpeningSubMenuNullCells(){
// call open Menu
MenuManager mockMenuManager = mock(MenuManager.class);
@@ -484,6 +504,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertFalse(mockMenuManager.openSubMenu(cell));
}
+ @Test
public void testOpeningSubMenu(){
// call open Menu
List<MenuCell> testCells = createTestCells();
@@ -492,7 +513,8 @@ public class MenuManagerTests extends AndroidTestCase2 {
// has to get success response to be true
assertTrue(menuManager.openSubMenu(testCells.get(3)));
}
-
+
+ @Test
public void testSetMenuConfiguration(){
menuManager.currentHMILevel = HMILevel.HMI_FULL;
menuManager.currentSystemContext = SystemContext.SYSCTXT_MAIN;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java
index e231ce634..724a53699 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java
@@ -32,22 +32,19 @@
package com.smartdevicelink.managers.screen.menu;
-import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.test.TestValues;
+import android.support.test.runner.AndroidJUnit4;
-public class RunScoreTests extends AndroidTestCase2 {
+import com.smartdevicelink.test.TestValues;
+import org.junit.Test;
+import org.junit.runner.RunWith;
- @Override
- public void setUp() throws Exception{
- super.setUp();
- }
+import static junit.framework.TestCase.assertEquals;
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
+@RunWith(AndroidJUnit4.class)
+public class RunScoreTests {
+ @Test
public void testSettersAndGetters(){
// set everything - we only use the constructor to set variables in the Menu Manager
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java
index 37908a8e9..a6eccbad0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java
@@ -32,21 +32,19 @@
package com.smartdevicelink.managers.screen.menu;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.test.TestValues;
-public class SubCellCommandListTests extends AndroidTestCase2 {
+import org.junit.Test;
+import org.junit.runner.RunWith;
- @Override
- public void setUp() throws Exception{
- super.setUp();
- }
+import static junit.framework.TestCase.assertEquals;
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
+@RunWith(AndroidJUnit4.class)
+public class SubCellCommandListTests {
+ @Test
public void testSettersAndGetters() {
RunScore runScore = new RunScore(TestValues.GENERAL_INT, TestValues.GENERAL_INTEGER_LIST, TestValues.GENERAL_INTEGER_LIST);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java
index 2b07fcfbf..72f52b3d5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java
@@ -32,7 +32,8 @@
package com.smartdevicelink.managers.screen.menu;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.protocol.enums.FunctionID;
@@ -43,6 +44,10 @@ import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -50,6 +55,11 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
@@ -57,7 +67,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-public class VoiceCommandManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class VoiceCommandManagerTests {
private VoiceCommand command, command3;
private List<VoiceCommand> commands;
@@ -67,9 +78,8 @@ public class VoiceCommandManagerTests extends AndroidTestCase2 {
// SETUP / HELPERS
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
VoiceCommandSelectionListener mockListener = mock(VoiceCommandSelectionListener.class);
command = new VoiceCommand(Arrays.asList("Command one", "Command two"), null);
@@ -117,7 +127,7 @@ public class VoiceCommandManagerTests extends AndroidTestCase2 {
assertNull(voiceCommandManager.inProgressUpdate);
}
- @Override
+ @After
public void tearDown() throws Exception {
voiceCommandManager.dispose();
@@ -131,10 +141,9 @@ public class VoiceCommandManagerTests extends AndroidTestCase2 {
assertFalse(voiceCommandManager.waitingOnHMIUpdate);
// after everything, make sure we are in the correct state
assertEquals(voiceCommandManager.getState(), BaseSubManager.SHUTDOWN);
-
- super.tearDown();
}
+ @Test
public void testStartVoiceCommandManager(){
voiceCommandManager.start(new CompletionListener() {
@@ -147,6 +156,7 @@ public class VoiceCommandManagerTests extends AndroidTestCase2 {
});
}
+ @Test
public void testHMINotReady(){
voiceCommandManager.currentHMILevel = HMILevel.HMI_NONE;
@@ -167,6 +177,7 @@ public class VoiceCommandManagerTests extends AndroidTestCase2 {
assertFalse(voiceCommandManager.waitingOnHMIUpdate);
}
+ @Test
public void testUpdatingCommands(){
// we have previously sent 2 VoiceCommand objects. we will now update it and have just one
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java
index 8df32be83..6be14c367 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java
@@ -32,10 +32,17 @@
package com.smartdevicelink.managers.screen.menu;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.test.TestValues;
-public class VoiceCommandTests extends AndroidTestCase2 {
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.TestCase.assertEquals;
+
+@RunWith(AndroidJUnit4.class)
+public class VoiceCommandTests {
private VoiceCommandSelectionListener voiceCommandSelectionListener = new VoiceCommandSelectionListener() {
@Override
@@ -44,16 +51,7 @@ public class VoiceCommandTests extends AndroidTestCase2 {
}
};
- @Override
- public void setUp() throws Exception{
- super.setUp();
- }
-
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testSettersAndGetters(){
VoiceCommand voiceCommand = new VoiceCommand(TestValues.GENERAL_STRING_LIST, voiceCommandSelectionListener);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
index 7b654752c..e6cb892bd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
@@ -3,12 +3,12 @@ package com.smartdevicelink.managers.video;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
+import android.support.test.runner.AndroidJUnit4;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.SessionType;
@@ -33,6 +33,9 @@ import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.util.Version;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -43,6 +46,10 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.eq;
@@ -51,27 +58,23 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import static android.support.test.InstrumentationRegistry.getContext;
/**
* This is a unit test class for the SmartDeviceLink video streaming manager class :
* {@link VideoStreamManager}
*/
-public class VideoStreamManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class VideoStreamManagerTests {
public static final String TAG = "VideoStreamManagerTests";
private Context mTestContext;
private static boolean touchEventOccured = false;
// SETUP / HELPERS
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
- mTestContext = this.getContext();
- }
-
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
+ mTestContext = getContext();
}
// TEST CLASSES
@@ -98,6 +101,7 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
// TESTS
+ @Test
public void testInitialization(){
ISdl internalInterface = mock(ISdl.class);
when(internalInterface.getProtocolVersion()).thenReturn(new Version(5,1,0));
@@ -131,6 +135,7 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
});
}
+ @Test
public void testHMILevelNotFull(){
final ISdl internalInterface = mock(ISdl.class);
@@ -156,6 +161,7 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
});
}
+ @Test
public void testRemoteDisplayStream(){
ISdl internalInterface = mock(ISdl.class);
@@ -272,6 +278,7 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
}
+ @Test
public void testConvertTouchEvent() {
ISdl internalInterface = mock(ISdl.class);
@@ -481,14 +488,17 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
+ @Test
public void testConvertTouchEvent_Scale_1() {
assertMotionEventWithScale(800, 480, 1.0f);
}
+ @Test
public void testConvertTouchEvent_Scale_1_25() {
assertMotionEventWithScale(1280, 768, 1.25f);
}
+ @Test
public void testConvertTouchEvent_Scale_1_5() {
assertMotionEventWithScale(1280, 768, 1.5f);
}
@@ -532,6 +542,7 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
assertEquals(Math.round(e1y / scale), Math.round(motionEvent.getY(0)));
}
+ @Test
public void testIsHMIStateVideoStreamCapable() {
VideoStreamManager videoStreamManager = new VideoStreamManager(mock(ISdl.class));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java
index e9e179659..e4a2555d2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java
@@ -1,12 +1,20 @@
package com.smartdevicelink.protocol;
+import android.support.test.runner.AndroidJUnit4;
+
import com.livio.BSON.BsonEncoder;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.protocol.enums.ControlFrameTags;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.HashMap;
-public class SdlPacketTests extends AndroidTestCase2 {
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNull;
+
+@RunWith(AndroidJUnit4.class)
+public class SdlPacketTests {
//TODO: Add tests to cover other parts of SdlPacket class
// Test variables
@@ -24,6 +32,7 @@ public class SdlPacketTests extends AndroidTestCase2 {
"70726f746f636f6c56657273" +
"696f6e0006000000352e302e300000");
+ @Test
public void testNull(){
byte[] testPayload = hexStringToByteArray(
"16000000" +
@@ -39,6 +48,7 @@ public class SdlPacketTests extends AndroidTestCase2 {
assertEquals(sdlPacket.getTag("hello"),"world");
}
+ @Test
public void testBsonDecoding(){
SdlPacket sdlPacket = new SdlPacket();
sdlPacket.setPayload(corePayload);
@@ -47,6 +57,7 @@ public class SdlPacketTests extends AndroidTestCase2 {
assertEquals(sdlPacket.getTag(ControlFrameTags.RPC.StartServiceACK.MTU), TEST_MTU);
}
+ @Test
public void testBsonEncoding(){
HashMap<String, Object> testMap = new HashMap<>();
testMap.put(ControlFrameTags.RPC.StartServiceACK.HASH_ID, TEST_HASH_ID);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
index 4c53e9b58..be04ce1f0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
@@ -1,8 +1,8 @@
package com.smartdevicelink.protocol;
+import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.SdlConnection.SdlConnection;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.security.SdlSecurityBase;
@@ -15,13 +15,24 @@ import com.smartdevicelink.transport.RouterServiceValidator;
import junit.framework.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.io.ByteArrayOutputStream;
import java.lang.reflect.Method;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.Mockito.mock;
+import static android.support.test.InstrumentationRegistry.getContext;
-public class SdlProtocolTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class SdlProtocolTests {
int max_int = 2147483647;
byte[] payload;
@@ -89,17 +100,20 @@ public class SdlProtocolTests extends AndroidTestCase2 {
DidReceiveListener onProtocolMessageReceivedListener = new DidReceiveListener();
+ @Before
public void setUp(){
- config = new MultiplexTransportConfig(this.mContext, SdlUnitTestContants.TEST_APP_ID);
+ config = new MultiplexTransportConfig(getContext(), SdlUnitTestContants.TEST_APP_ID);
protocol = new SdlProtocol(defaultListener,config);
}
+ @Test
public void testBase(){
SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
}
+ @Test
public void testVersion(){
SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
@@ -133,6 +147,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
assertEquals((byte)0x01,sdlProtocol.getProtocolVersion().getMajor());
}
+ @Test
public void testMtu(){
SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
@@ -167,6 +182,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
}
+ @Test
public void testHandleFrame(){
SampleRpc sampleRpc = new SampleRpc(4);
SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
@@ -177,6 +193,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
Assert.fail("Exceptin during handleFrame - " + e.toString());
}
}
+ @Test
public void testHandleFrameCorrupt(){
SampleRpc sampleRpc = new SampleRpc(4);
BinaryFrameHeader header = sampleRpc.getBinaryFrameHeader(true);
@@ -191,6 +208,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
}
}
+ @Test
public void testHandleSingleFrameMessageFrame(){
SampleRpc sampleRpc = new SampleRpc(4);
SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
@@ -206,6 +224,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
}
}
+ @Test
public void testHandleSingleFrameMessageFrameCorruptBfh(){
SampleRpc sampleRpc = new SampleRpc(4);
@@ -245,7 +264,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
-
+ @Test
public void testNormalCase(){
setUp();
payload = new byte[]{0x00,0x02,0x05,0x01,0x01,0x01,0x05,0x00};
@@ -290,6 +309,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
assertNull(oom_error);
}
+ @Test
public void testOverallocatingAccumulator(){
setUp();
ByteArrayOutputStream builder = new ByteArrayOutputStream();
@@ -357,7 +377,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
public void onTransportDisconnected(String info) {
connected = false;
//Grab a currently running router service
- RouterServiceValidator rsvp2 = new RouterServiceValidator(mContext);
+ RouterServiceValidator rsvp2 = new RouterServiceValidator(getContext());
rsvp2.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
assertTrue(rsvp2.validate());
assertNotNull(rsvp2.getService());