summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Kast <julian@livio.com>2020-07-29 21:02:02 -0400
committerJulian Kast <julian@livio.com>2020-07-29 21:02:02 -0400
commitcc406b9ed45020cf83a34c74afccd9f812fe0716 (patch)
tree1f78b7c340dc027cc1a5f8eef48b175ec9035bf8
parent36dbbf81978f1b95648b2432f2b2c37773119c73 (diff)
downloadsdl_android-cc406b9ed45020cf83a34c74afccd9f812fe0716.tar.gz
Added unit test for DriverDistraction to HMICapabilitiesTests.java
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
index 87c83cb74..27f510b32 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
@@ -9,6 +9,7 @@ import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import static com.smartdevicelink.proxy.rpc.HMICapabilities.KEY_DRIVER_DISTRACTION;
import static com.smartdevicelink.proxy.rpc.HMICapabilities.KEY_NAVIGATION;
import static com.smartdevicelink.proxy.rpc.HMICapabilities.KEY_PHONE_CALL;
import static com.smartdevicelink.proxy.rpc.HMICapabilities.KEY_VIDEO_STREAMING;
@@ -23,6 +24,7 @@ public class HMICapabilitiesTests extends TestCase {
msg.setNavigationAvilable(TestValues.GENERAL_BOOLEAN);
msg.setPhoneCallAvilable(TestValues.GENERAL_BOOLEAN);
msg.setVideoStreamingAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setDriverDistraction(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -33,11 +35,13 @@ public class HMICapabilitiesTests extends TestCase {
Boolean navAvail = msg.isNavigationAvailable();
Boolean phoneAvail = msg.isPhoneCallAvailable();
Boolean vidStreamAvail = msg.isVideoStreamingAvailable();
+ Boolean driverDistractionAvail = msg.isDriverDistractionAvailable();
// Valid Tests
assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, navAvail);
assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, phoneAvail);
assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, vidStreamAvail);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, driverDistractionAvail);
// Invalid/Null Tests
HMICapabilities msg = new HMICapabilities();
@@ -46,6 +50,8 @@ public class HMICapabilitiesTests extends TestCase {
assertFalse(msg.isNavigationAvailable());
assertFalse(msg.isPhoneCallAvailable());
assertFalse(msg.isVideoStreamingAvailable());
+ assertFalse(msg.isDriverDistractionAvailable());
+
}
public void testJson(){
@@ -55,6 +61,7 @@ public class HMICapabilitiesTests extends TestCase {
reference.put(KEY_NAVIGATION, TestValues.GENERAL_BOOLEAN);
reference.put(HMICapabilities.KEY_PHONE_CALL, TestValues.GENERAL_BOOLEAN);
reference.put(HMICapabilities.KEY_VIDEO_STREAMING, TestValues.GENERAL_BOOLEAN);
+ reference.put(KEY_DRIVER_DISTRACTION, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
@@ -67,6 +74,9 @@ public class HMICapabilitiesTests extends TestCase {
assertEquals(TestValues.MATCH, JsonUtils.readStringListFromJsonObject(reference, KEY_VIDEO_STREAMING),
JsonUtils.readStringListFromJsonObject(underTest, KEY_VIDEO_STREAMING));
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(reference, KEY_DRIVER_DISTRACTION),
+ JsonUtils.readStringFromJsonObject(underTest, KEY_DRIVER_DISTRACTION));
+
} catch(JSONException e){
fail(TestValues.JSON_FAIL);
}