summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJordan Liu <jminjie@google.com>2016-12-14 14:26:24 -0800
committerJordan Liu <jminjie@google.com>2016-12-14 14:26:24 -0800
commitb1c3813087408bf31f99310365f05204596cf584 (patch)
tree88219da95e4e2c1a50e32d82b087fc11d89149f3 /tests
parent711dbd69d5fc6eb8ea915482f3dc8f53f62b0901 (diff)
downloadandroid_packages_apps_CarrierConfig-b1c3813087408bf31f99310365f05204596cf584.tar.gz
android_packages_apps_CarrierConfig-b1c3813087408bf31f99310365f05204596cf584.tar.bz2
android_packages_apps_CarrierConfig-b1c3813087408bf31f99310365f05204596cf584.zip
Verify that string/int-array has "num" attribute
In carrier_config xml files, string-array and int-array items require a "num" attribute that specifies the number of elements in the array. Running the unit-test now verifies that the "num" attribute is present. Test: runtest carrierconfig-unit Change-Id: If378d7ee7f4c90d320f6f93f5d6bb0a27f44d6c9
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/carrierconfig/CarrierConfigTest.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/src/com/android/carrierconfig/CarrierConfigTest.java b/tests/src/com/android/carrierconfig/CarrierConfigTest.java
index 8404302..3efe3d6 100644
--- a/tests/src/com/android/carrierconfig/CarrierConfigTest.java
+++ b/tests/src/com/android/carrierconfig/CarrierConfigTest.java
@@ -83,12 +83,16 @@ public class CarrierConfigTest extends InstrumentationTestCase {
while (((event = parser.next()) != XmlPullParser.END_DOCUMENT)) {
if (event == XmlPullParser.START_TAG) {
switch (parser.getName()) {
+ case "int-array":
+ case "string-array":
+ // string-array and int-array require the 'num' attribute
+ final String varNum = parser.getAttributeValue(null, "num");
+ assertNotNull("No 'num' attribute in array: "
+ + parser.getPositionDescription(), varNum);
case "int":
case "long":
case "boolean":
case "string":
- case "int-array":
- case "string-array":
// NOTE: This doesn't check for other valid Bundle values, but it
// is limited to the key types in CarrierConfigManager.
final String varName = parser.getAttributeValue(null, "name");