ParseFacebookUtils { public static Task<ParseUser> logInInBackground(AccessToken accessToken) { checkInitialization(); return userDelegate.logInWithInBackground(AUTH_TYPE, getController().getAuthData(accessToken)); } private  ParseFacebookUtils(); static boolean isLinked(ParseUser user); static void initialize(Context context); static void initialize(Context context, int callbackRequestCodeOffset); static boolean onActivityResult(int requestCode, int resultCode, Intent data); static Task<ParseUser> logInInBackground(AccessToken accessToken); static Task<ParseUser> logInInBackground(AccessToken accessToken, LogInCallback callback); static Task<ParseUser> logInWithReadPermissionsInBackground(Activity activity,
                                                                       Collection<String> permissions); static Task<ParseUser> logInWithReadPermissionsInBackground(Activity activity,
                                                                       Collection<String> permissions, LogInCallback callback); static Task<ParseUser> logInWithPublishPermissionsInBackground(Activity activity,
                                                                          Collection<String> permissions); static Task<ParseUser> logInWithPublishPermissionsInBackground(Activity activity,
                                                                          Collection<String> permissions, LogInCallback callback); static Task<ParseUser> logInWithReadPermissionsInBackground(Fragment fragment,
                                                                       Collection<String> permissions); static Task<ParseUser> logInWithReadPermissionsInBackground(Fragment fragment,
                                                                       Collection<String> permissions, LogInCallback callback); static Task<ParseUser> logInWithPublishPermissionsInBackground(Fragment fragment,
                                                                          Collection<String> permissions); static Task<ParseUser> logInWithPublishPermissionsInBackground(Fragment fragment,
                                                                          Collection<String> permissions, LogInCallback callback); static Task<Void> linkInBackground(ParseUser user, AccessToken accessToken); static Task<Void> linkInBackground(ParseUser user, AccessToken accessToken,
                                              SaveCallback callback); static Task<Void> linkWithReadPermissionsInBackground(ParseUser user,
                                                                 Activity activity, Collection<String> permissions); static Task<Void> linkWithReadPermissionsInBackground(ParseUser user,
                                                                 Activity activity, Collection<String> permissions, SaveCallback callback); static Task<Void> linkWithPublishPermissionsInBackground(ParseUser user,
                                                                    Activity activity, Collection<String> permissions); static Task<Void> linkWithPublishPermissionsInBackground(ParseUser user,
                                                                    Activity activity, Collection<String> permissions, SaveCallback callback); static Task<Void> linkWithReadPermissionsInBackground(ParseUser user,
                                                                 Fragment fragment, Collection<String> permissions); static Task<Void> linkWithReadPermissionsInBackground(ParseUser user,
                                                                 Fragment fragment, Collection<String> permissions, SaveCallback callback); static Task<Void> linkWithPublishPermissionsInBackground(ParseUser user,
                                                                    Fragment fragment, Collection<String> permissions); static Task<Void> linkWithPublishPermissionsInBackground(ParseUser user,
                                                                    Fragment fragment, Collection<String> permissions, SaveCallback callback); static Task<Void> unlinkInBackground(ParseUser user); static Task<Void> unlinkInBackground(ParseUser user, SaveCallback callback);  }
@Test public void testLogInWithAccessToken() { Map<String, String> authData = new HashMap<>(); when(controller.getAuthData(any(AccessToken.class))).thenReturn(authData); ParseFacebookUtils.isInitialized = true; ParseUser user = mock(ParseUser.class); when(userDelegate.logInWithInBackground(anyString(), anyMapOf(String.class, String.class))) .thenReturn(Task.forResult(user)); AccessToken token = TestUtils.newAccessToken(); Task<ParseUser> task = ParseFacebookUtils.logInInBackground(token); verify(controller).getAuthData(token); verify(userDelegate).logInWithInBackground("facebook", authData); assertTrue(task.isCompleted()); assertEquals(user, task.getResult()); }