diff options
author | BrettyWhite <geekman3454@protonmail.com> | 2017-05-04 15:22:33 -0400 |
---|---|---|
committer | BrettyWhite <geekman3454@protonmail.com> | 2017-05-04 15:22:33 -0400 |
commit | 80cd51dc7650b6af08f1022eb775523e80a87645 (patch) | |
tree | 937b2d28661ff67a3251b3df756a6a2d753d5493 | |
parent | 5ac2b7bae42a6f9ea609f7d23fc1bd52c09ffebb (diff) | |
download | sdl_android-80cd51dc7650b6af08f1022eb775523e80a87645.tar.gz |
setting class var for testbugfix/utest_RSVTestCase
-rw-r--r-- | sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java | 29 |
1 files changed, 13 insertions, 16 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 77eb3a4ef..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,32 +193,29 @@ 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)); + assertTrue(TEST.equals(retVal)); - String retValNew; StringBuilder builder = new StringBuilder(); for(int i = 0; i<1000; i++){ - builder.append(test); + builder.append(TEST); } assertTrue(RouterServiceValidator.setTrustedList(mContext,builder.toString())); - retValNew = RouterServiceValidator.getTrustedList(mContext); - assertNotNull(retValNew); - assertTrue(builder.toString().equals(retValNew)); + retVal = RouterServiceValidator.getTrustedList(mContext); + assertNotNull(retVal); + assertTrue(builder.toString().equals(retVal)); } public void testInvalidationSequence(){ @@ -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); |