summaryrefslogtreecommitdiff
path: root/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes
diff options
context:
space:
mode:
authorShinichi Watanabe <swatanabe@xevo.com>2020-09-16 15:18:18 +0900
committerShinichi Watanabe <swatanabe@xevo.com>2020-09-16 15:18:18 +0900
commit0aeb8da0119132f4b316c9d1983bbcfa9baba79f (patch)
tree6233534867bb1888d56a052537772275d2bdb698 /android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes
parenta4f25398780ef4ef94e930baa54857534f2cbf0a (diff)
parentde8e5c9a71ba2c4c793bcf6fcccbb964fe25853a (diff)
downloadsdl_android-0aeb8da0119132f4b316c9d1983bbcfa9baba79f.tar.gz
Merge remote-tracking branch 'upstream/develop' into feature/issue-1361
Diffstat (limited to 'android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes')
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DriverDistractionCapabilityTest.java3
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StabilityControlsStatusTests.java58
3 files changed, 84 insertions, 1 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DriverDistractionCapabilityTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DriverDistractionCapabilityTest.java
index 2e98296a1..767c264fa 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DriverDistractionCapabilityTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DriverDistractionCapabilityTest.java
@@ -3,9 +3,12 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.DriverDistractionCapability;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.TestValues;
+
import junit.framework.TestCase;
+
import org.json.JSONException;
import org.json.JSONObject;
+
import java.util.Iterator;
/**
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java
index f8bb07caf..6e23edc7a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java
@@ -1,6 +1,8 @@
package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.FuelRange;
+import com.smartdevicelink.proxy.rpc.enums.CapacityUnit;
+import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
import com.smartdevicelink.proxy.rpc.enums.FuelType;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.TestValues;
@@ -26,6 +28,10 @@ public class FuelRangeTests extends TestCase{
msg.setType(TestValues.GENERAL_FUELTYPE);
msg.setRange(TestValues.GENERAL_FLOAT);
+ msg.setLevel(TestValues.GENERAL_FLOAT);
+ msg.setLevelState(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ msg.setCapacity(TestValues.GENERAL_FLOAT);
+ msg.setCapacityUnit(TestValues.GENERAL_CAPACITYUNIT);
}
/**
@@ -35,10 +41,18 @@ public class FuelRangeTests extends TestCase{
// Test Values
FuelType fuelType = msg.getType();
float range = msg.getRange();
-
+ float level = msg.getLevel();
+ ComponentVolumeStatus levelState = msg.getLevelState();
+ CapacityUnit capacityUnit = msg.getCapacityUnit();
+ float capacity = msg.getCapacity();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, range);
assertEquals(TestValues.MATCH, TestValues.GENERAL_FUELTYPE, fuelType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, level);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, levelState);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_CAPACITYUNIT, capacityUnit);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, capacity);
// Invalid/Null Tests
FuelRange msg = new FuelRange();
@@ -46,6 +60,10 @@ public class FuelRangeTests extends TestCase{
assertNull(TestValues.NULL, msg.getType());
assertNull(TestValues.NULL, msg.getRange());
+ assertNull(TestValues.NULL, msg.getLevel());
+ assertNull(TestValues.NULL, msg.getLevelState());
+ assertNull(TestValues.NULL, msg.getCapacityUnit());
+ assertNull(TestValues.NULL, msg.getCapacity());
}
public void testJson(){
@@ -54,6 +72,10 @@ public class FuelRangeTests extends TestCase{
try{
reference.put(FuelRange.KEY_TYPE, TestValues.GENERAL_FUELTYPE);
reference.put(FuelRange.KEY_RANGE, (Float) TestValues.GENERAL_FLOAT);
+ reference.put(FuelRange.KEY_LEVEL, TestValues.GENERAL_FLOAT);
+ reference.put(FuelRange.KEY_LEVEL_STATE, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ reference.put(FuelRange.KEY_CAPACITY, TestValues.GENERAL_FLOAT);
+ reference.put(FuelRange.KEY_CAPACITY_UNIT, TestValues.GENERAL_CAPACITYUNIT);
JSONObject underTest = msg.serializeJSON();
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StabilityControlsStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StabilityControlsStatusTests.java
new file mode 100644
index 000000000..1de8abfdf
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StabilityControlsStatusTests.java
@@ -0,0 +1,58 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.StabilityControlsStatus;
+import com.smartdevicelink.proxy.rpc.enums.VehicleDataStatus;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.TestValues;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+public class StabilityControlsStatusTests extends TestCase {
+ private StabilityControlsStatus msg;
+
+ @Override
+ public void setUp() {
+ msg = new StabilityControlsStatus();
+
+ msg.setEscSystem(TestValues.GENERAL_ESC_SYSTEM);
+ msg.setTrailerSwayControl(TestValues.GENERAL_S_WAY_CONTROL);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ VehicleDataStatus esc = msg.getEscSystem();
+ VehicleDataStatus sTrailer = msg.getTrailerSwayControl();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_ESC_SYSTEM, esc);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_S_WAY_CONTROL, sTrailer);
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(StabilityControlsStatus.KEY_TRAILER_SWAY_CONTROL, TestValues.GENERAL_S_WAY_CONTROL);
+ reference.put(StabilityControlsStatus.KEY_ESC_SYSTEM, TestValues.GENERAL_ESC_SYSTEM);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file