summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2017-05-05 11:06:29 -0400
committerGitHub <noreply@github.com>2017-05-05 11:06:29 -0400
commit850cf09a4d84b4253a6a9675cb53c9fbedd2a9d4 (patch)
treefbdddd5de7e2c68445683f43fa8f6eae01955b2e
parent74ad7994f22c6caace45034378a8cf2ce85cf10d (diff)
parent80cd51dc7650b6af08f1022eb775523e80a87645 (diff)
downloadsdl_android-850cf09a4d84b4253a6a9675cb53c9fbedd2a9d4.tar.gz
Merge pull request #491 from smartdevicelink/bugfix/utest_RSVTestCase
bugfix/utest_RSVTestCase
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java25
1 files changed, 11 insertions, 14 deletions
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java b/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java
index 03abbc7f4..d28dabddc 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java
@@ -23,7 +23,7 @@ public class RSVTestCase extends AndroidTestCase {
private static final long REFRESH_TRUSTED_APP_LIST_TIME_DAY = 3600000 * 24; // A day in ms
private static final long REFRESH_TRUSTED_APP_LIST_TIME_WEEK = REFRESH_TRUSTED_APP_LIST_TIME_DAY * 7; // A week in ms
private static final long REFRESH_TRUSTED_APP_LIST_TIME_MONTH = REFRESH_TRUSTED_APP_LIST_TIME_DAY * 30; // A ~month in ms
-
+ private static final String TEST = "{\"response\": {\"com.livio.sdl\" : { \"versionBlacklist\":[] }, \"com.lexus.tcapp\" : { \"versionBlacklist\":[] }, \"com.toyota.tcapp\" : { \"versionBlacklist\": [] } , \"com.sdl.router\":{\"versionBlacklist\": [] },\"com.ford.fordpass\" : { \"versionBlacklist\":[] } }}";
RouterServiceValidator rsvp;
/**
* Set this boolean if you want to test the actual validation of router service
@@ -193,27 +193,24 @@ public class RSVTestCase extends AndroidTestCase {
assertFalse(RouterServiceValidator.setTrustedList(mContext,null));
assertFalse(RouterServiceValidator.setTrustedList(null,"test"));
assertTrue(RouterServiceValidator.setTrustedList(mContext,"test"));
- String test = "{\"response\": {\"com.livio.sdl\" : { \"versionBlacklist\":[] }, \"com.lexus.tcapp\" : { \"versionBlacklist\":[] }, \"com.toyota.tcapp\" : { \"versionBlacklist\": [] } , \"com.sdl.router\":{\"versionBlacklist\": [] },\"com.ford.fordpass\" : { \"versionBlacklist\":[] } }}";
- assertTrue(RouterServiceValidator.setTrustedList(mContext,test));
- assertTrue(RouterServiceValidator.setTrustedList(mContext,test+test+test+test+test));
+ assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST));
+ assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST+TEST+TEST+TEST+TEST));
StringBuilder builder = new StringBuilder();
for(int i = 0; i<1000; i++){
- builder.append(test);
+ builder.append(TEST);
}
assertTrue(RouterServiceValidator.setTrustedList(mContext,builder.toString()));
}
public void testTrustedListSetAndGet(){
- String test = "{\"response\": {\"com.livio.sdl\" : { \"versionBlacklist\":[] }, \"com.lexus.tcapp\" : { \"versionBlacklist\":[] }, \"com.toyota.tcapp\" : { \"versionBlacklist\": [] } , \"com.sdl.router\":{\"versionBlacklist\": [] },\"com.ford.fordpass\" : { \"versionBlacklist\":[] } }}";
- assertTrue(RouterServiceValidator.setTrustedList(mContext,test));
+ assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST));
String retVal = RouterServiceValidator.getTrustedList(mContext);
assertNotNull(retVal);
- assertTrue(test.equals(retVal));
-
- retVal = null;
+ assertTrue(TEST.equals(retVal));
+
StringBuilder builder = new StringBuilder();
for(int i = 0; i<1000; i++){
- builder.append(test);
+ builder.append(TEST);
}
assertTrue(RouterServiceValidator.setTrustedList(mContext,builder.toString()));
retVal = RouterServiceValidator.getTrustedList(mContext);
@@ -310,10 +307,10 @@ public class RSVTestCase extends AndroidTestCase {
public void testRequestChange(){
RouterServiceValidator.setLastRequest(mContext, null);
assertNull(RouterServiceValidator.getLastRequest(mContext));
- String test = "{\"response\": {\"com.livio.sdl\" : { \"versionBlacklist\":[] }, \"com.lexus.tcapp\" : { \"versionBlacklist\":[] }, \"com.toyota.tcapp\" : { \"versionBlacklist\": [] } , \"com.sdl.router\":{\"versionBlacklist\": [] },\"com.ford.fordpass\" : { \"versionBlacklist\":[] } }}";
+
JSONObject object = null;
try {
- object = new JSONObject(test);
+ object = new JSONObject(TEST);
} catch (JSONException e) {
e.printStackTrace();
}
@@ -327,7 +324,7 @@ public class RSVTestCase extends AndroidTestCase {
assertTrue(object.toString().equals(oldRequest));
//Now test a new list
- test = "{\"response\": {\"com.livio.sdl\" : { \"versionBlacklist\":[] }, \"com.lexus.tcapp\" : { \"versionBlacklist\":[] }, \"com.test.test\" : { \"versionBlacklist\":[] },\"com.toyota.tcapp\" : { \"versionBlacklist\": [] } , \"com.sdl.router\":{\"versionBlacklist\": [] },\"com.ford.fordpass\" : { \"versionBlacklist\":[] } }}";
+ String test = "{\"response\": {\"com.livio.sdl\" : { \"versionBlacklist\":[] }, \"com.lexus.tcapp\" : { \"versionBlacklist\":[] }, \"com.test.test\" : { \"versionBlacklist\":[] },\"com.toyota.tcapp\" : { \"versionBlacklist\": [] } , \"com.sdl.router\":{\"versionBlacklist\": [] },\"com.ford.fordpass\" : { \"versionBlacklist\":[] } }}";
object = null;
try {
object = new JSONObject(test);