@SmallTest public void testLaunchingWithEmptyIntent() throws Exception { final TestBlocker blocker = getTestBlocker();
@SmallTest public void testLaunchingWithValidNativeLinkingIntent() { final TestBlocker blocker = getTestBlocker();
@SmallTest public void testSetVersion() throws Exception { String currentVersion = FacebookSdk.getGraphApiVersion(); FacebookSdk.setGraphApiVersion("v4.5"); GraphRequest requestMe = new GraphRequest(null, "TourEiffel"); HttpURLConnection connection = GraphRequest.toHttpConnection(requestMe); assertTrue(connection != null); assertEquals("GET", connection.getRequestMethod()); assertEquals("v4.5", FacebookSdk.getGraphApiVersion()); assertEquals("/v4.5" + "/TourEiffel", connection.getURL().getPath()); assertTrue(connection.getRequestProperty("User-Agent").startsWith("FBAndroidSDK")); Uri uri = Uri.parse(connection.getURL().toString()); assertEquals("android", uri.getQueryParameter("sdk")); assertEquals("json", uri.getQueryParameter("format")); FacebookSdk.setGraphApiVersion(currentVersion); } }
@SmallTest public void testHeader() { // com.qiniu.android.http.UserAgent#getUa // return new String((ua + "; " + _part + ")").getBytes(Charset.forName("ISO-8859-1"))); String name = new String(("电话☎️的の").getBytes(Charset.forName("ISO-8859-1"))); String value = new String(("sdf✈️he覆盖😁🆚9837-=/ df").getBytes(Charset.forName("ISO-8859-1"))); checkNameAndValue(name, value); }
@SmallTest public void testSharedPreferencesMethodsForwarded() { uut.getString("key", "default"); verify(prefs).getString(eq("key"), eq("default")); }
@SmallTest public void testKeyByString() { uut.getValue(); verify(prefs).getString(eq("string"), any(String.class)); uut.setValue("value"); verify(editor).putString(eq("string"), any(String.class)); }
@SmallTest public void testGetWithDefault() { uut.getValueWithDefault(); uut.getValueWithDefault("default"); verify(prefs, times(2)).getString(eq("string"), eq("default")); }
@SmallTest public void testInvalidtoken_z0() throws Throwable { final String expectKey = "你好"; info = uploadManager.syncPut("hello".getBytes(), expectKey, "invalid", null); resp = info.response; // key = resp.optString("key"); // Assert.assertEquals(info.toString(), expectKey, key); Assert.assertEquals(info.toString(), ResponseInfo.InvalidToken, info.statusCode); Assert.assertNotNull(info.reqId); Assert.assertNull(resp); }
@SmallTest public void testAttributes() { assertEquals(resources.getColor(android.R.color.holo_red_dark), testPreferencesActivity.customPreference.titleColor); assertEquals(resources.getColor(android.R.color.holo_blue_dark), testPreferencesActivity.customPreference.summaryColor); } }
@SmallTest public void testNoData() throws Throwable { final String expectKey = "你好"; info = uploadManager.syncPut((byte[]) null, expectKey, "invalid", null); resp = info.response; Assert.assertEquals(info.toString(), ResponseInfo.InvalidArgument, info.statusCode); Assert.assertNull(resp); }
@SmallTest public void testColor() { assertEquals(res.getColor(android.R.color.holo_red_dark), testView.testColor); assertEquals(res.getColor(android.R.color.holo_red_dark), defaultsTestView.testColor); }
@SmallTest public void testDimensionPixelOffset() { assertEquals(res.getDimensionPixelOffset(R.dimen.test_dimen), testView.testDimensionPixelOffset); assertEquals(res.getDimensionPixelOffset(R.dimen.test_dimen), defaultsTestView.testDimensionPixelOffset); }
@SmallTest public void testDimension() { assertEquals(res.getDimension(R.dimen.test_dimen), testView.testDimension, 0.01f); assertEquals(res.getDimension(R.dimen.test_dimen), defaultsTestView.testDimension, 0.01f); }
@SmallTest public void testDimensionPixelSize() { assertEquals(res.getDimensionPixelSize(R.dimen.test_dimen), testView.testDimensionPixelSize); assertEquals(res.getDimensionPixelSize(R.dimen.test_dimen), defaultsTestView.testDimensionPixelSize); }
@SmallTest public void testEmptytoken_z0() throws Throwable { final String expectKey = "你好"; info = uploadManager.syncPut(new byte[1], expectKey, "", null); resp = info.response; Assert.assertEquals(info.toString(), ResponseInfo.InvalidArgument, info.statusCode); Assert.assertNull(resp); }
@SmallTest public void testApplyWithoutSaving() { final SaveModeApplyInterface uut = StoreBox.create( getActivity(), SaveModeApplyInterface.class); uut.setValueWithoutApplying("value"); verify(editor, never()).apply(); verify(editor, never()).commit(); }
@SmallTest public void testNotoken_z0() throws Throwable { final String expectKey = "你好"; info = uploadManager.syncPut(new byte[1], expectKey, null, null); resp = info.response; Assert.assertEquals(info.toString(), ResponseInfo.InvalidArgument, info.statusCode); Assert.assertNull(resp); }
@SmallTest public void testCommit() { final SaveModeCommitInterface uut = StoreBox.create( getActivity(), SaveModeCommitInterface.class); uut.setValue("value"); verify(editor).commit(); verify(editor, never()).apply(); }
@SmallTest public void testRemoveUsingIntKey() { uut.removeUsingIntKey(R.string.key_int); assertFalse(prefs.contains(KEY)); }
@SmallTest public void testRemoveWithResourceAnnotation() { uut.removeWithResourceAnnotation(); assertFalse(prefs.contains(KEY)); } }