///////////////// ////// KEY ////// ///////////////// public void testCorrectLengthKey() throws URISyntaxException { ConfigUriBeacon configUriBeacon = new ConfigUriBeacon.Builder() .uriString(TestData.emptyTestString) .key(TestData.validKey) .build(); MoreAsserts.assertEquals(TestData.validKey, configUriBeacon.getKey()); }
public void testWithNoUriCreateConfigUriBeacon() throws URISyntaxException { ConfigUriBeacon configUriBeacon = ConfigUriBeacon.createConfigUriBeacon(TestData.emptyAdbPacketBytes); assertEquals(ConfigUriBeacon.NO_URI, configUriBeacon.getUriString()); assertEquals(TestData.noTxPowerLevel, configUriBeacon.getTxPowerLevel()); assertEquals(TestData.noFlags, configUriBeacon.getFlags()); MoreAsserts.assertEquals(TestData.emptyTestByteArray, configUriBeacon.getUriBytes()); }
private void validateCookies(String responseCookie, String... expectedCookieNames) { String[] cookies = responseCookie.split(";"); Set<String> foundCookieNames = new HashSet<String>(); for (String cookie : cookies) { foundCookieNames.add(cookie.substring(0, cookie.indexOf("=")).trim()); } MoreAsserts.assertEquals( foundCookieNames, new HashSet<String>(Arrays.asList(expectedCookieNames))); }
public void testCorrectPowerLevels() throws URISyntaxException { for (byte i = ConfigUriBeacon.TX_POWER_LEVEL_MIN_VALUE; i <= ConfigUriBeacon.TX_POWER_LEVEL_MAX_VALUE; i++) { byte[] testTxPowerLevels = makeTxPowerLevelArray(i); ConfigUriBeacon beacon = new ConfigUriBeacon.Builder() .uriString(TestData.emptyTestString) .advertisedTxPowerLevels(testTxPowerLevels) .beaconPeriod(TestData.validPeriod) .txPowerMode(TestData.validTxPowerMode) .build(); MoreAsserts.assertEquals(testTxPowerLevels, beacon.getAdvertisedTxPowerLevels()); } }
@MediumTest public void testLocaleenUS() throws Exception { insertStrings(); Log.i("LocaleTest", "about to call setLocale en_US"); mDatabase.setLocale(new Locale("en", "US")); String[] results; results = query("SELECT data FROM test ORDER BY data COLLATE LOCALIZED ASC"); // The database code currently uses PRIMARY collation strength, // meaning that all versions of a character compare equal (regardless // of case or accents), leaving the "cote" flavors in database order. MoreAsserts.assertEquals( results, new String[] { STRINGS[4], // "boy" STRINGS[0], // sundry forms of "cote" STRINGS[1], STRINGS[2], STRINGS[3], STRINGS[6], // "COTE" STRINGS[5], // "dog" }); }
public void testValidLongUrlString() throws URISyntaxException { ConfigUriBeacon configUriBeacon = new ConfigUriBeacon.Builder().uriString(TestData.longButValidUrlString).build(); assertEquals(TestData.longButValidUrlString, configUriBeacon.getUriString()); MoreAsserts.assertEquals(TestData.longButValidUrlByteArray, configUriBeacon.getUriBytes()); }
public void testWithEmptyUriByteArray() throws URISyntaxException { ConfigUriBeacon configUriBeacon = new ConfigUriBeacon.Builder().uriString(TestData.emptyTestByteArray).build(); assertEquals(TestData.emptyTestString, configUriBeacon.getUriString()); MoreAsserts.assertEquals(TestData.emptyTestByteArray, configUriBeacon.getUriBytes()); }
public void testValidLongUrlCreateConfigUriBeacon() throws URISyntaxException { ConfigUriBeacon configUriBeacon = ConfigUriBeacon.createConfigUriBeacon(TestData.longValidUrlAdbPacketBytes); assertEquals(TestData.longButValidUrlString, configUriBeacon.getUriString()); MoreAsserts.assertEquals(TestData.longButValidUrlByteArray, configUriBeacon.getUriBytes()); }
public void testEnumerateAccounts() throws Exception { addSomeRecords(); otpProvider.enumerateAccounts(result); MoreAsserts.assertContentsInAnyOrder( result, "*****@*****.**", "*****@*****.**", "*****@*****.**"); }
public void testEnumerateAccountsNoRecords() throws Exception { assertEquals(0, otpProvider.enumerateAccounts(result)); MoreAsserts.assertEmpty(result); }
@MediumTest public void testLocaleInsertOrder() throws Exception { insertStrings(); String[] results = query("SELECT data FROM test"); MoreAsserts.assertEquals(STRINGS, results); }