@Before public void before() throws Exception { FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); RuntimeEnvironment.application.getSharedPreferences( ProfileCache.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) .edit(). clear(). commit(); }
@Before public void setup() { mMockActivity = mock(Activity.class); mMockContentResolver = mock(ContentResolver.class); when(mMockActivity.getContentResolver()).thenReturn(mMockContentResolver); FacebookSdk.setApplicationId("200"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); PowerMockito.mockStatic(FacebookSignatureValidator.class); }
@Before public void init() { FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); }
@Override public void setUp() { super.setUp(); FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); }
@Before public void before() throws Exception { FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); }
@Before public void before() throws Exception { FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); }
@Before public void before() { FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); }
@Before public void before() { FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); // Reset the static state every time so tests don't interfere with each other. Whitebox.setInternalState( CallbackManagerImpl.class, "staticCallbacks", new HashMap<Integer, CallbackManagerImpl.Callback>()); }
@Before @Override public void before() throws Exception { super.before(); FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); }
@Before public void before() throws Exception { FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); r1 = new GraphRequest(null, "4"); r2 = new GraphRequest(null, "4"); progressMap = new HashMap<GraphRequest, RequestProgress>(); progressMap.put(r1, new RequestProgress(null, r1)); progressMap.get(r1).addToMax(5); progressMap.put(r2, new RequestProgress(null, r2)); progressMap.get(r2).addToMax(5); requests = new GraphRequestBatch(r1, r2); ByteArrayOutputStream backing = new ByteArrayOutputStream(); stream = new ProgressOutputStream(backing, requests, progressMap, MAX_PROGRESS); }
@Before @Override public void before() throws Exception { super.before(); FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); }
@Before public void init() { FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); AnalyticsUserIDStore.initStore(); }
@Before public void before() throws Exception { FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); stream = new ProgressNoopOutputStream(null); }
@Test public void testFromCacheWithMissingApplicationId() { String token = "AnImaginaryTokenValue"; String applicationId = "1234"; Bundle bundle = new Bundle(); LegacyTokenHelper.putToken(bundle, token); // no app id FacebookSdk.setApplicationId(applicationId); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); AccessToken accessToken = AccessToken.createFromLegacyCache(bundle); assertEquals(applicationId, accessToken.getApplicationId()); }
@Before public void before() { Whitebox.setInternalState(FacebookSdk.class, "callbackRequestCodeOffset", 0xface); Whitebox.setInternalState(FacebookSdk.class, "sdkInitialized", false); stub(method(FetchedAppSettingsManager.class, "loadAppSettingsAsync")).toReturn(null); FacebookSdk.setAutoLogAppEventsEnabled(false); }
@Test public void testReauthorizationWithSameFbidSucceeds() throws Exception { FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); LoginClient.Request request = createRequest(ACCESS_TOKEN);
@Test public void testGetSetCurrentProfile() { FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); Profile profile1 = createDefaultProfile(); Profile.setCurrentProfile(profile1); assertEquals(ProfileManager.getInstance().getCurrentProfile(), profile1); assertEquals(profile1, Profile.getCurrentProfile()); Profile.setCurrentProfile(null); assertNull(ProfileManager.getInstance().getCurrentProfile()); assertNull(Profile.getCurrentProfile()); } }
@Test public void testStartStopTrackingAndBroadcast() { FacebookSdk.setApplicationId("123456789"); FacebookSdk.setAutoLogAppEventsEnabled(false); FacebookSdk.sdkInitialize(RuntimeEnvironment.application); LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(RuntimeEnvironment.application); TestProfileTracker testProfileTracker = new TestProfileTracker(); // Starts tracking assertTrue(testProfileTracker.isTracking()); testProfileTracker.stopTracking(); assertFalse(testProfileTracker.isTracking()); sendBroadcast(localBroadcastManager, null, ProfileTest.createDefaultProfile()); assertFalse(testProfileTracker.isCallbackCalled); testProfileTracker.startTracking(); assertTrue(testProfileTracker.isTracking()); Profile profile = ProfileTest.createDefaultProfile(); sendBroadcast(localBroadcastManager, null, profile); assertNull(testProfileTracker.oldProfile); assertEquals(profile, testProfileTracker.currentProfile); assertTrue(testProfileTracker.isCallbackCalled); Profile profile1 = ProfileTest.createMostlyNullsProfile(); Profile profile2 = ProfileTest.createDefaultProfile(); sendBroadcast(localBroadcastManager, profile1, profile2); ProfileTest.assertMostlyNullsObjectGetters(testProfileTracker.oldProfile); ProfileTest.assertDefaultObjectGetters(testProfileTracker.currentProfile); assertEquals(profile1, testProfileTracker.oldProfile); assertEquals(profile2, testProfileTracker.currentProfile); testProfileTracker.stopTracking(); }