summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Kirk <askirk@umich.edu>2017-06-07 15:03:52 -0400
committerAustin Kirk <askirk@umich.edu>2017-06-07 15:03:52 -0400
commit9ee3b285081097c59065147a173a28bb14b303e5 (patch)
treef6d29a9f63c74e4434645a2263db12a4f7c34b43
parent070661af0bf6df90dda1da31775a2b532dfecb05 (diff)
downloadsdl_android-9ee3b285081097c59065147a173a28bb14b303e5.tar.gz
Adding Missing Unit Tests for RPCs
-rw-r--r--sdl_android/src/androidTest/assets/json/DialNumber.json13
-rw-r--r--sdl_android/src/androidTest/assets/json/GetWayPoints.json18
-rw-r--r--sdl_android/src/androidTest/assets/json/StreamRPC.json10
-rw-r--r--sdl_android/src/androidTest/assets/json/SubscribeWayPoints.json10
-rw-r--r--sdl_android/src/androidTest/assets/json/UnsubscribeWayPoints.json10
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java30
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java68
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java73
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java109
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java70
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java113
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java95
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnStreamRPCTests.java76
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java86
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java97
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java96
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java73
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java73
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DialNumberResponseTests.java74
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java123
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/StreamRPCResponseTests.java89
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeWaypointsResponseTests.java73
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeWayPointsResponseTests.java73
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java10
24 files changed, 1559 insertions, 3 deletions
diff --git a/sdl_android/src/androidTest/assets/json/DialNumber.json b/sdl_android/src/androidTest/assets/json/DialNumber.json
new file mode 100644
index 000000000..cb79aad84
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/DialNumber.json
@@ -0,0 +1,13 @@
+{
+ "request":{
+ "name":"DialNumber",
+ "correlationID":194,
+ "parameters":{
+ "wayPointType":"DESTINATION"
+ }
+ },
+ "response":{
+ "name":"DialNumberResponse",
+ "correlationID":195
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/assets/json/GetWayPoints.json b/sdl_android/src/androidTest/assets/json/GetWayPoints.json
new file mode 100644
index 000000000..8d06a9dd6
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/GetWayPoints.json
@@ -0,0 +1,18 @@
+{
+ "request":{
+ "name":"GetWayPoints",
+ "correlationID":196,
+ "parameters":{
+ "wayPointType":"DESTINATION"
+ }
+ },
+ "response":{
+ "name":"GetWayPointsResponse",
+ "correlationID":197,
+ "parameters":{
+ "wayPoints":[
+ {}, {}
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/assets/json/StreamRPC.json b/sdl_android/src/androidTest/assets/json/StreamRPC.json
new file mode 100644
index 000000000..ff20ffc93
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/StreamRPC.json
@@ -0,0 +1,10 @@
+{
+ "response":{
+ "name":"StreamRPCResponse",
+ "correlationID":198,
+ "parameters":{
+ "fileName":"test",
+ "fileSize":100
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/assets/json/SubscribeWayPoints.json b/sdl_android/src/androidTest/assets/json/SubscribeWayPoints.json
new file mode 100644
index 000000000..bd1eee5c6
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/SubscribeWayPoints.json
@@ -0,0 +1,10 @@
+{
+ "request":{
+ "name":"SubscribeWayPoints",
+ "correlationID":199
+ },
+ "response":{
+ "name":"SubscribeWayPointsResponse",
+ "correlationID":200
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/assets/json/UnsubscribeWayPoints.json b/sdl_android/src/androidTest/assets/json/UnsubscribeWayPoints.json
new file mode 100644
index 000000000..60e2a98e4
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/UnsubscribeWayPoints.json
@@ -0,0 +1,10 @@
+{
+ "request":{
+ "name":"UnsubscribeWayPoints",
+ "correlationID":201
+ },
+ "response":{
+ "name":"UnsubscribeWayPointsResponse",
+ "correlationID":202
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
index 9acf6e24e..9ebfcd078 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test;
-import java.util.ArrayList;
+import android.util.Log;
import java.util.Arrays;
import java.util.List;
@@ -8,12 +8,12 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
-import android.util.Log;
import com.smartdevicelink.proxy.TTSChunkFactory;
import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
import com.smartdevicelink.proxy.rpc.Choice;
+import com.smartdevicelink.proxy.rpc.Coordinate;
import com.smartdevicelink.proxy.rpc.DIDResult;
import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
@@ -22,7 +22,9 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.ImageField;
import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
+import com.smartdevicelink.proxy.rpc.LocationDetails;
import com.smartdevicelink.proxy.rpc.MenuParams;
+import com.smartdevicelink.proxy.rpc.OasisAddress;
import com.smartdevicelink.proxy.rpc.ParameterPermissions;
import com.smartdevicelink.proxy.rpc.PermissionItem;
import com.smartdevicelink.proxy.rpc.PresetBankCapabilities;
@@ -126,6 +128,9 @@ public class Test {
public static final HMILevel GENERAL_HMILEVEL = HMILevel.HMI_FULL;
public static final DIDResult GENERAL_DIDRESULT = new DIDResult();
public static final TextField GENERAL_TEXTFIELD = new TextField();
+ public static final OasisAddress GENERAL_OASISADDRESS = new OasisAddress();
+ public static final Coordinate GENERAL_COORDINATE = new Coordinate();
+ public static final LocationDetails GENERAL_LOCATIONDETAILS = new LocationDetails();
public static final Dimension GENERAL_DIMENSION = Dimension._2D;
public static final ImageType GENERAL_IMAGETYPE = ImageType.DYNAMIC;
public static final AudioType GENERAL_AUDIOTYPE = AudioType.PCM;
@@ -295,6 +300,27 @@ public class Test {
GENERAL_TEXTFIELD.setWidth(GENERAL_INT);
GENERAL_TEXTFIELD.setCharacterSet(GENERAL_CHARACTERSET);
GENERAL_TEXTFIELD_LIST.add(GENERAL_TEXTFIELD);
+
+ GENERAL_COORDINATE.setLongitudeDegrees(GENERAL_FLOAT);
+ GENERAL_COORDINATE.setLatitudeDegrees(GENERAL_FLOAT);
+
+ GENERAL_OASISADDRESS.setCountryName(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setThoroughfare(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setSubThoroughfare(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setCountryCode(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setPostalCode(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setLocality(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setSubLocality(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setAdministrativeArea(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setSubAdministrativeArea(GENERAL_STRING);
+
+ GENERAL_LOCATIONDETAILS.setAddressLines(GENERAL_STRING_LIST);
+ GENERAL_LOCATIONDETAILS.setCoordinate(GENERAL_COORDINATE);
+ GENERAL_LOCATIONDETAILS.setLocationDescription(GENERAL_STRING);
+ GENERAL_LOCATIONDETAILS.setLocationImage(GENERAL_IMAGE);
+ GENERAL_LOCATIONDETAILS.setLocationName(GENERAL_STRING);
+ GENERAL_LOCATIONDETAILS.setSearchAddress(GENERAL_OASISADDRESS);
+ GENERAL_LOCATIONDETAILS.setPhoneNumber(GENERAL_STRING);
GENERAL_FILETYPE_LIST.add(GENERAL_FILETYPE);
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
index e20098a60..d19bc225b 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
@@ -14,6 +14,7 @@ import com.smartdevicelink.proxy.rpc.BodyInformation;
import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
import com.smartdevicelink.proxy.rpc.Choice;
import com.smartdevicelink.proxy.rpc.ClusterModeStatus;
+import com.smartdevicelink.proxy.rpc.Coordinate;
import com.smartdevicelink.proxy.rpc.DIDResult;
import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.DeviceStatus;
@@ -30,6 +31,7 @@ import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.MyKey;
+import com.smartdevicelink.proxy.rpc.OasisAddress;
import com.smartdevicelink.proxy.rpc.ParameterPermissions;
import com.smartdevicelink.proxy.rpc.PermissionItem;
import com.smartdevicelink.proxy.rpc.PresetBankCapabilities;
@@ -298,6 +300,72 @@ public class Validator{
return true;
}
+ public static boolean validateCoordinate(Coordinate c1, Coordinate c2){
+ if(c1 == null){
+ return ( c2 == null );
+ }
+ if(c2 == null){
+ return ( c1 == null );
+ }
+
+ if(c1.getLatitudeDegrees() != c2.getLatitudeDegrees()){
+ return false;
+ }
+
+ if(c1.getLongitudeDegrees() != c2.getLongitudeDegrees()){
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateOasisAddress(OasisAddress a1, OasisAddress a2){
+ if(a1 == null){
+ return ( a2 == null );
+ }
+ if(a2 == null){
+ return ( a1 == null );
+ }
+
+ if(!a1.getAdministrativeArea().equals(a2.getAdministrativeArea())){
+ return false;
+ }
+
+ if(!a1.getCountryCode().equals(a2.getCountryCode())){
+ return false;
+ }
+
+ if(!a1.getCountryName().equals(a2.getCountryName())){
+ return false;
+ }
+
+ if(!a1.getLocality().equals(a2.getLocality())){
+ return false;
+ }
+
+ if(!a1.getSubLocality().equals(a2.getSubLocality())){
+ return false;
+ }
+
+ if(!a1.getSubAdministrativeArea().equals(a2.getSubAdministrativeArea())){
+ return false;
+ }
+
+ if(!a1.getPostalCode().equals(a2.getPostalCode())){
+ return false;
+ }
+
+ if(!a1.getThoroughfare().equals(a2.getThoroughfare())){
+ return false;
+ }
+
+ if(!a1.getSubThoroughfare().equals(a2.getSubThoroughfare())){
+ return false;
+ }
+
+ return true;
+ }
+
public static boolean validateTtsChunks(List<TTSChunk> list1, List<TTSChunk> list2){
if(list1 == null){
return ( list2 == null );
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java
new file mode 100644
index 000000000..5f8a8327f
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.Coordinate;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * Created by austinkirk on 6/6/17.
+ */
+
+public class CoordinateTests extends TestCase {
+
+ private Coordinate msg;
+
+ @Override
+ public void setUp(){
+ msg = new Coordinate();
+
+ msg.setLatitudeDegrees(Test.GENERAL_FLOAT);
+ msg.setLongitudeDegrees(Test.GENERAL_FLOAT);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ float floatLat = msg.getLatitudeDegrees();
+ float floatLong = msg.getLongitudeDegrees();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_FLOAT, floatLat);
+ assertEquals(Test.MATCH, Test.GENERAL_FLOAT, floatLong);
+ // Invalid/Null Tests
+ Coordinate msg = new Coordinate();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getLatitudeDegrees());
+ assertNull(Test.NULL, msg.getLongitudeDegrees());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(Coordinate.KEY_LATITUDE_DEGREES, (Float) Test.GENERAL_FLOAT);
+ reference.put(Coordinate.KEY_LONGITUDE_DEGREES, (Float) Test.GENERAL_FLOAT);
+
+ JSONObject underTest = msg.serializeJSON();
+
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ Object a = JsonUtils.readObjectFromJsonObject(reference, key);
+ Object b = JsonUtils.readObjectFromJsonObject(underTest, key);
+
+ assertEquals(Test.MATCH, a, b);
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java
new file mode 100644
index 000000000..2cf38b68f
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java
@@ -0,0 +1,109 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.DateTime;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * Created by austinkirk on 6/6/17.
+ */
+
+public class DateTimeTests extends TestCase {
+
+ private DateTime msg;
+
+ @Override
+ public void setUp(){
+ msg = new DateTime();
+
+ msg.setYear(Test.GENERAL_INT);
+ msg.setMonth(Test.GENERAL_INT);
+ msg.setDay(Test.GENERAL_INT);
+ msg.setHour(Test.GENERAL_INT);
+ msg.setMinute(Test.GENERAL_INT);
+ msg.setSecond(Test.GENERAL_INT);
+ msg.setMilliSecond(Test.GENERAL_INT);
+ msg.setTzHour(Test.GENERAL_INT);
+ msg.setTzMinute(Test.GENERAL_INT);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Integer year = msg.getYear();
+ Integer month = msg.getMonth();
+ Integer day = msg.getDay();
+ Integer hour = msg.getHour();
+ Integer min = msg.getMinute();
+ Integer sec = msg.getSecond();
+ Integer ms = msg.getMilliSecond();
+ Integer tzHour = msg.getTzHour();
+ Integer tzMin = msg.getTzMinute();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, year);
+ assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, month);
+ assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, day);
+ assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, hour);
+ assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, min);
+ assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, sec);
+ assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, ms);
+ assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, tzHour);
+ assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, tzMin);
+
+ // Invalid/Null Tests
+ DateTime msg = new DateTime();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getYear());
+ assertNull(Test.NULL, msg.getMonth());
+ assertNull(Test.NULL, msg.getDay());
+ assertNull(Test.NULL, msg.getHour());
+ assertNull(Test.NULL, msg.getMinute());
+ assertNull(Test.NULL, msg.getSecond());
+ assertNull(Test.NULL, msg.getMilliSecond());
+ assertNull(Test.NULL, msg.getTzHour());
+ assertNull(Test.NULL, msg.getTzMinute());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(DateTime.KEY_YEAR, (Integer) Test.GENERAL_INT);
+ reference.put(DateTime.KEY_MONTH, (Integer) Test.GENERAL_INT);
+ reference.put(DateTime.KEY_DAY, (Integer) Test.GENERAL_INT);
+ reference.put(DateTime.KEY_HOUR, (Integer) Test.GENERAL_INT);
+ reference.put(DateTime.KEY_MINUTE, (Integer) Test.GENERAL_INT);
+ reference.put(DateTime.KEY_SECOND, (Integer) Test.GENERAL_INT);
+ reference.put(DateTime.KEY_MILLISECOND, (Integer) Test.GENERAL_INT);
+ reference.put(DateTime.KEY_TZ_HOUR, (Integer) Test.GENERAL_INT);
+ reference.put(DateTime.KEY_TZ_MINUTE, (Integer) Test.GENERAL_INT);
+
+ JSONObject underTest = msg.serializeJSON();
+
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ Object a = JsonUtils.readObjectFromJsonObject(reference, key);
+ Object b = JsonUtils.readObjectFromJsonObject(underTest, key);
+
+ assertEquals(Test.MATCH, a, b);
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
new file mode 100644
index 000000000..e548685ad
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
@@ -0,0 +1,70 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.HMICapabilities;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import static com.smartdevicelink.proxy.rpc.HMICapabilities.KEY_NAVIGATION;
+import static com.smartdevicelink.proxy.rpc.HMICapabilities.KEY_PHONE_CALL;
+
+/**
+ * Created by austinkirk on 6/7/17.
+ */
+
+public class HMICapabilitiesTests extends TestCase {
+ private HMICapabilities msg;
+
+ @Override
+ public void setUp(){
+ msg = new HMICapabilities();
+
+ msg.setNavigationAvilable(Test.GENERAL_BOOLEAN);
+ msg.setPhoneCallAvilable(Test.GENERAL_BOOLEAN);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Boolean navAvail = msg.isNavigationAvailable();
+ Boolean phoneAvail = msg.isPhoneCallAvailable();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, navAvail);
+ assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, phoneAvail);
+
+ // Invalid/Null Tests
+ HMICapabilities msg = new HMICapabilities();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertFalse(msg.isNavigationAvailable());
+ assertFalse(msg.isPhoneCallAvailable());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(KEY_NAVIGATION, Test.GENERAL_BOOLEAN);
+ reference.put(HMICapabilities.KEY_PHONE_CALL, Test.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(reference, KEY_NAVIGATION),
+ JsonUtils.readStringListFromJsonObject(underTest, KEY_NAVIGATION));
+
+ assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(reference, KEY_PHONE_CALL),
+ JsonUtils.readStringListFromJsonObject(underTest, KEY_PHONE_CALL));
+
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java
new file mode 100644
index 000000000..18da17eac
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java
@@ -0,0 +1,113 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.Coordinate;
+import com.smartdevicelink.proxy.rpc.Image;
+import com.smartdevicelink.proxy.rpc.LocationDetails;
+import com.smartdevicelink.proxy.rpc.OasisAddress;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.List;
+
+/**
+ * Created by austinkirk on 6/7/17.
+ */
+
+public class LocationDetailsTests extends TestCase {
+ private LocationDetails msg;
+
+ @Override
+ public void setUp(){
+ msg = Test.GENERAL_LOCATIONDETAILS;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ List<String> field1 = msg.getAddressLines();
+ String field2 = msg.getLocationDescription();
+ String field3 = msg.getLocationName();
+ String field4 = msg.getPhoneNumber();
+ Coordinate field5 = msg.getCoordinate();
+ Image field6 = msg.getLocationImage();
+ OasisAddress field7 = msg.getSearchAddress();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST, field1);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, field2);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, field3);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, field4);
+ assertEquals(Test.MATCH, Test.GENERAL_COORDINATE, field5);
+ assertEquals(Test.MATCH, Test.GENERAL_IMAGE, field6);
+ assertEquals(Test.MATCH, Test.GENERAL_OASISADDRESS, field7);
+
+ // Invalid/Null Tests
+ LocationDetails msg = new LocationDetails();
+ assertNotNull(Test.NOT_NULL, msg);
+
+
+ assertNull(msg.getAddressLines());
+ assertNull(msg.getLocationDescription());
+ assertNull(msg.getLocationName());
+ assertNull(msg.getPhoneNumber());
+ assertNull(msg.getCoordinate());
+ assertNull(msg.getLocationImage());
+ assertNull(msg.getSearchAddress());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(LocationDetails.KEY_ADDRESS_LINES, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ reference.put(LocationDetails.KEY_LOCATION_DESCRIPTION, Test.GENERAL_STRING);
+ reference.put(LocationDetails.KEY_LOCATION_NAME, Test.GENERAL_STRING);
+ reference.put(LocationDetails.KEY_PHONE_NUMBER, Test.GENERAL_STRING);
+ reference.put(LocationDetails.KEY_COORDINATE, Test.GENERAL_COORDINATE);
+ reference.put(LocationDetails.KEY_LOCATION_IMAGE, Test.GENERAL_IMAGE);
+ reference.put(LocationDetails.KEY_SEARCH_ADDRESS, Test.GENERAL_OASISADDRESS);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, LocationDetails.KEY_ADDRESS_LINES),
+ JsonUtils.readObjectFromJsonObject(underTest, LocationDetails.KEY_ADDRESS_LINES));
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(reference, LocationDetails.KEY_LOCATION_DESCRIPTION),
+ JsonUtils.readStringFromJsonObject(underTest, LocationDetails.KEY_LOCATION_DESCRIPTION));
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(reference, LocationDetails.KEY_LOCATION_NAME),
+ JsonUtils.readStringFromJsonObject(underTest, LocationDetails.KEY_LOCATION_NAME));
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(reference, LocationDetails.KEY_PHONE_NUMBER),
+ JsonUtils.readStringFromJsonObject(underTest, LocationDetails.KEY_PHONE_NUMBER));
+
+ assertTrue(Validator.validateCoordinate(
+ (Coordinate) JsonUtils.readObjectFromJsonObject(reference, LocationDetails.KEY_COORDINATE),
+ new Coordinate(JsonRPCMarshaller.deserializeJSONObject( (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, LocationDetails.KEY_COORDINATE))))
+ );
+
+ assertTrue(Validator.validateImage(
+ (Image) JsonUtils.readObjectFromJsonObject(reference, LocationDetails.KEY_LOCATION_IMAGE),
+ new Image(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(underTest, LocationDetails.KEY_LOCATION_IMAGE)))
+ ));
+
+ assertTrue(Validator.validateOasisAddress(
+ (OasisAddress) JsonUtils.readObjectFromJsonObject(reference, LocationDetails.KEY_SEARCH_ADDRESS),
+ new OasisAddress(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(underTest, LocationDetails.KEY_SEARCH_ADDRESS)))
+ ));
+
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java
new file mode 100644
index 000000000..cf39a3c18
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java
@@ -0,0 +1,95 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.OasisAddress;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * Created by austinkirk on 6/7/17.
+ */
+
+public class OasisAddressTests extends TestCase {
+ private OasisAddress msg;
+
+ @Override
+ public void setUp(){
+ msg = Test.GENERAL_OASISADDRESS;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String f1 = msg.getAdministrativeArea();
+ String f2 = msg.getSubAdministrativeArea();
+ String f3 = msg.getCountryCode();
+ String f4 = msg.getCountryName();
+ String f5 = msg.getLocality();
+ String f6 = msg.getSubLocality();
+ String f7 = msg.getPostalCode();
+ String f8 = msg.getThoroughfare();
+ String f9 = msg.getSubThoroughfare();
+
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, f1);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, f2);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, f3);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, f4);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, f5);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, f6);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, f7);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, f8);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, f9);
+
+ // Invalid/Null Tests
+ OasisAddress msg = new OasisAddress();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(msg.getAdministrativeArea());
+ assertNull(msg.getSubAdministrativeArea());
+ assertNull(msg.getCountryCode());
+ assertNull(msg.getCountryName());
+ assertNull(msg.getLocality());
+ assertNull(msg.getSubLocality());
+ assertNull(msg.getPostalCode());
+ assertNull(msg.getThoroughfare());
+ assertNull(msg.getSubThoroughfare());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(OasisAddress.KEY_ADMINISTRATIVE_AREA, Test.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_SUB_ADMINISTRATIVE_AREA, Test.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_COUNTRY_CODE, Test.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_COUNTRY_NAME, Test.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_LOCALITY, Test.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_SUB_LOCALITY, Test.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_POSTAL_CODE, Test.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_THOROUGH_FARE, Test.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_SUB_THOROUGH_FARE, Test.GENERAL_STRING);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(Test.MATCH, reference.get(key),
+ underTest.get(key));
+ }
+
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnStreamRPCTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnStreamRPCTests.java
new file mode 100644
index 000000000..58db7d8eb
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnStreamRPCTests.java
@@ -0,0 +1,76 @@
+package com.smartdevicelink.test.rpc.notifications;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.OnStreamRPC;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.Test;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * Created by austinkirk on 6/7/17.
+ */
+
+public class OnStreamRPCTests extends BaseRpcTests {
+ @Override
+ protected RPCMessage createMessage(){
+ OnStreamRPC msg = new OnStreamRPC();
+
+ msg.setBytesComplete(Test.GENERAL_LONG);
+ msg.setFileName(Test.GENERAL_STRING);
+ msg.setFileSize(Test.GENERAL_LONG);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_NOTIFICATION;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.ON_STREAM_RPC.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(OnStreamRPC.KEY_BYTESCOMPLETE, Test.GENERAL_LONG);
+ result.put(OnStreamRPC.KEY_FILENAME, Test.GENERAL_STRING);
+ result.put(OnStreamRPC.KEY_FILESIZE, Test.GENERAL_LONG);
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Long bytes = ((OnStreamRPC) msg).getBytesComplete();
+ String fileName = ((OnStreamRPC) msg).getFileName();
+ Long fileSize = ((OnStreamRPC) msg).getFileSize();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_LONG, bytes);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, fileName);
+ assertEquals(Test.MATCH, Test.GENERAL_LONG, fileSize);
+
+ // Invalid/Null Tests
+ OnStreamRPC msg = new OnStreamRPC();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getBytesComplete());
+ assertNull(Test.NULL, msg.getFileName());
+ assertNull(Test.NULL, msg.getFileSize());
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java
new file mode 100644
index 000000000..dcc02dafd
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java
@@ -0,0 +1,86 @@
+package com.smartdevicelink.test.rpc.notifications;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetWayPointsResponse;
+import com.smartdevicelink.proxy.rpc.LocationDetails;
+import com.smartdevicelink.proxy.rpc.OnWayPointChange;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.Test;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by austinkirk on 6/7/17.
+ */
+
+public class OnWayPointChangeTests extends BaseRpcTests {
+ @Override
+ protected RPCMessage createMessage(){
+ OnWayPointChange msg = new OnWayPointChange();
+
+ List<LocationDetails> list = new ArrayList<>();
+ list.add(Test.GENERAL_LOCATIONDETAILS);
+ list.add(Test.GENERAL_LOCATIONDETAILS);
+
+ msg.setWayPoints(list);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_NOTIFICATION;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.ON_WAY_POINT_CHANGE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ JSONArray jsonArray = new JSONArray();
+ try {
+ jsonArray.put(JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LOCATIONDETAILS.getStore()));
+ jsonArray.put(JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LOCATIONDETAILS.getStore()));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ try {
+ result.put(GetWayPointsResponse.KEY_WAY_POINTS, jsonArray);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ List<LocationDetails> list = ((OnWayPointChange) msg).getWayPoints();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_LOCATIONDETAILS, list.get(0));
+ assertEquals(Test.MATCH, Test.GENERAL_LOCATIONDETAILS, list.get(1));
+
+ // Invalid/Null Tests
+ OnWayPointChange msg = new OnWayPointChange();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getWayPoints());
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java
new file mode 100644
index 000000000..40a8d432f
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java
@@ -0,0 +1,97 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.DialNumber;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * Created by austinkirk on 6/6/17.
+ */
+
+public class DialNumberTests extends BaseRpcTests {
+
+ private final String TEST_NUMBER = "5558675309";
+
+ @Override
+ protected RPCMessage createMessage(){
+ DialNumber msg = new DialNumber();
+
+ msg.setNumber(TEST_NUMBER);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.DIAL_NUMBER.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(DialNumber.KEY_NUMBER, TEST_NUMBER);
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String testNumber = ((DialNumber) msg).getNumber();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, TEST_NUMBER, testNumber);
+ // Invalid/Null Tests
+ DialNumber msg = new DialNumber();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getNumber());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DialNumber cmd = new DialNumber(hash);
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, DialNumber.KEY_NUMBER), cmd.getNumber());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java
new file mode 100644
index 000000000..bf0531685
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java
@@ -0,0 +1,96 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetWayPoints;
+import com.smartdevicelink.proxy.rpc.enums.WayPointType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * Created by austinkirk on 6/6/17.
+ */
+
+public class GetWayPointsTests extends BaseRpcTests {
+ @Override
+ protected RPCMessage createMessage(){
+ GetWayPoints msg = new GetWayPoints();
+
+ msg.setWayPointType(WayPointType.DESTINATION);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.GET_WAY_POINTS.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(GetWayPoints.KEY_WAY_POINT_TYPE, WayPointType.DESTINATION);
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ WayPointType testType = ( (GetWayPoints) msg ).getWayPointType();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, WayPointType.DESTINATION, testType);
+
+ // Invalid/Null Tests
+ GetWayPoints msg = new GetWayPoints();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getWayPointType());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetWayPoints cmd = new GetWayPoints(hash);
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, WayPointType.valueForString(JsonUtils.readStringFromJsonObject(parameters, GetWayPoints.KEY_WAY_POINT_TYPE)), cmd.getWayPointType());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java
new file mode 100644
index 000000000..06b6ee330
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.SubscribeWayPoints;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * Created by austinkirk on 6/7/17.
+ */
+
+public class SubscribeWayPointsTests extends BaseRpcTests {
+ @Override
+ protected RPCMessage createMessage() {
+ return new SubscribeWayPoints();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SUBSCRIBE_WAY_POINTS.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ SubscribeWayPoints msg = new SubscribeWayPoints();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SubscribeWayPoints cmd = new SubscribeWayPoints(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java
new file mode 100644
index 000000000..ac4afbbea
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.UnsubscribeWayPoints;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * Created by austinkirk on 6/7/17.
+ */
+
+public class UnsubscribeWayPointsTests extends BaseRpcTests {
+ @Override
+ protected RPCMessage createMessage() {
+ return new UnsubscribeWayPoints();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.UNSUBSCRIBE_WAY_POINTS.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ UnsubscribeWayPoints msg = new UnsubscribeWayPoints();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UnsubscribeWayPoints cmd = new UnsubscribeWayPoints(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DialNumberResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DialNumberResponseTests.java
new file mode 100644
index 000000000..bf625f19a
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DialNumberResponseTests.java
@@ -0,0 +1,74 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.DialNumberResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * Created by austinkirk on 6/6/17.
+ */
+
+public class DialNumberResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ return new DialNumberResponse();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.DIAL_NUMBER.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ DialNumberResponse msg = new DialNumberResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DialNumberResponse cmd = new DialNumberResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java
new file mode 100644
index 000000000..57d8499df
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java
@@ -0,0 +1,123 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetWayPointsResponse;
+import com.smartdevicelink.proxy.rpc.LocationDetails;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+
+/**
+ * Created by austinkirk on 6/6/17.
+ */
+
+public class GetWayPointsResponseTests extends BaseRpcTests {
+ List<LocationDetails> waypoints = new ArrayList<LocationDetails>();
+
+ @Override
+ protected RPCMessage createMessage() {
+
+ waypoints.add(Test.GENERAL_LOCATIONDETAILS);
+ waypoints.add(Test.GENERAL_LOCATIONDETAILS);
+
+ GetWayPointsResponse getWayPointsResponse = new GetWayPointsResponse();
+ getWayPointsResponse.setWayPoints(waypoints);
+
+ return getWayPointsResponse;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_WAY_POINTS.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ JSONArray jsonArray = new JSONArray();
+ try {
+ jsonArray.put(JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LOCATIONDETAILS.getStore()));
+ jsonArray.put(JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LOCATIONDETAILS.getStore()));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ try {
+ result.put(GetWayPointsResponse.KEY_WAY_POINTS, jsonArray);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+
+ // Test Values
+ List<LocationDetails> testWPs = ( (GetWayPointsResponse) msg ).getWayPoints();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, waypoints, testWPs);
+
+ // Invalid/Null Tests
+ GetWayPointsResponse msg = new GetWayPointsResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getWayPoints());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetWayPointsResponse cmd = new GetWayPointsResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ JSONArray locArray = JsonUtils.readJsonArrayFromJsonObject(parameters, GetWayPointsResponse.KEY_WAY_POINTS);
+ List<LocationDetails> locationList = new ArrayList<LocationDetails>();
+ for (int index = 0; index < locArray.length(); index++) {
+ LocationDetails det = new LocationDetails(JsonRPCMarshaller.deserializeJSONObject( (JSONObject) locArray.get(index)));
+ locationList.add(det);
+ }
+ List<LocationDetails> dets = cmd.getWayPoints();
+ assertEquals(Test.MATCH, locationList.size(), dets.size());
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/StreamRPCResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/StreamRPCResponseTests.java
new file mode 100644
index 000000000..47801ea90
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/StreamRPCResponseTests.java
@@ -0,0 +1,89 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.StreamRPCResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * Created by austinkirk on 6/7/17.
+ */
+
+public class StreamRPCResponseTests extends BaseRpcTests {
+ @Override
+ protected RPCMessage createMessage(){
+ StreamRPCResponse response = new StreamRPCResponse();
+ response.setFileSize((Long) Test.GENERAL_LONG);
+ response.setFileName(Test.GENERAL_STRING);
+ return response;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.STREAM_RPC.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(StreamRPCResponse.KEY_FILESIZE, (Long) Test.GENERAL_LONG);
+ result.put(StreamRPCResponse.KEY_FILENAME, Test.GENERAL_STRING);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ StreamRPCResponse msg = new StreamRPCResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ StreamRPCResponse cmd = new StreamRPCResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, StreamRPCResponse.KEY_FILENAME), cmd.getFileName());
+ assertEquals(Test.MATCH, JsonUtils.readLongFromJsonObject(parameters, StreamRPCResponse.KEY_FILESIZE), cmd.getFileSize());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeWaypointsResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeWaypointsResponseTests.java
new file mode 100644
index 000000000..a43220dce
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeWaypointsResponseTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.SubscribeWayPointsResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * Created by austinkirk on 6/7/17.
+ */
+
+public class SubscribeWaypointsResponseTests extends BaseRpcTests {
+ @Override
+ protected RPCMessage createMessage(){
+ return new SubscribeWayPointsResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.SUBSCRIBE_WAY_POINTS.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ SubscribeWayPointsResponse msg = new SubscribeWayPointsResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SubscribeWayPointsResponse cmd = new SubscribeWayPointsResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals("Correlation ID doesn't match input ID", JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeWayPointsResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeWayPointsResponseTests.java
new file mode 100644
index 000000000..b8b69be60
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeWayPointsResponseTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.UnsubscribeWayPointsResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * Created by austinkirk on 6/7/17.
+ */
+
+public class UnsubscribeWayPointsResponseTests extends BaseRpcTests{
+ @Override
+ protected RPCMessage createMessage(){
+ return new UnsubscribeWayPointsResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.UNSUBSCRIBE_WAY_POINTS.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ UnsubscribeWayPointsResponse msg = new UnsubscribeWayPointsResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UnsubscribeWayPointsResponse cmd = new UnsubscribeWayPointsResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals("Correlation ID doesn't match input ID", JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
index 49e128185..ab4763103 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
@@ -112,5 +112,13 @@ public class RPCMessage extends RPCStruct {
public Boolean getBoolean(String key) { return (Boolean) parameters.get(key); }
@Override
- public Long getLong(String key){ return (Long) parameters.get(key); }
+ public Long getLong(String key){
+ Object result = parameters.get(key);
+ if (result instanceof Integer) {
+ return ((Integer) result).longValue();
+ }else if(result instanceof Long){
+ return (Long) result;
+ }
+ return null;
+ }
}