LoginManager { public void loginForAuthorizationCode(@NonNull Activity activity) { if (!legacyUriRedirectHandler.checkValidState(activity, this)) { return; } Intent intent = LoginActivity.newIntent(activity, sessionConfiguration, ResponseType.CODE, legacyUriRedirectHandler.isLegacyMode()); activity.startActivityForResult(intent, requestCode); } LoginManager(
            @NonNull AccessTokenStorage accessTokenStorage,
            @NonNull LoginCallback loginCallback);  LoginManager(
            @NonNull AccessTokenStorage accessTokenStorage,
            @NonNull LoginCallback loginCallback,
            @NonNull SessionConfiguration configuration);  LoginManager(
            @NonNull AccessTokenStorage accessTokenStorage,
            @NonNull LoginCallback loginCallback,
            @NonNull SessionConfiguration configuration,
            int requestCode);   LoginManager(
            @NonNull AccessTokenStorage accessTokenStorage,
            @NonNull LoginCallback loginCallback,
            @NonNull SessionConfiguration configuration,
            int requestCode,
            @NonNull LegacyUriRedirectHandler legacyUriRedirectHandler); void login(final @NonNull Activity activity); @Deprecated void loginForImplicitGrant(@NonNull Activity activity); void loginForAuthorizationCode(@NonNull Activity activity); @Deprecated @NonNull @SuppressWarnings("unchecked") T getAccessTokenManager(); @NonNull AccessTokenStorage getAccessTokenStorage(); LoginCallback getLoginCallback(); @NonNull SessionConfiguration getSessionConfiguration(); @NonNull Session<?> getSession(); boolean isAuthenticated(); @Deprecated LoginManager setRedirectForAuthorizationCode(boolean redirectForAuthorizationCode); @Deprecated boolean isRedirectForAuthorizationCode(); LoginManager setAuthCodeFlowEnabled(boolean authCodeFlowEnabled); LoginManager setProductFlowPriority(@NonNull Collection<SupportedAppType> productFlowPriority); boolean isAuthCodeFlowEnabled(); void onActivityResult(
            @NonNull Activity activity,
            int requestCode,
            int resultCode,
            @Nullable Intent data);  }
@Test public void loginForAuthorizationCode_withLegacyModeBlocking_shouldNotLogin() { when(legacyUriRedirectHandler.checkValidState(eq(activity), eq(loginManager))).thenReturn(false); loginManager.loginForAuthorizationCode(activity); verify(activity, never()).startActivityForResult(any(Intent.class), anyInt()); }
@Test public void loginForAuthorizationCode_withoutLegacyModeBlocking_shouldLoginWithAuthCodeFlowParams() { loginManager.loginForAuthorizationCode(activity); ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class); ArgumentCaptor<Integer> codeCaptor = ArgumentCaptor.forClass(Integer.class); verify(activity).startActivityForResult(intentCaptor.capture(), codeCaptor.capture()); final Intent resultIntent = intentCaptor.getValue(); validateLoginIntentFields(resultIntent, new ArrayList<SupportedAppType>(), sessionConfiguration, ResponseType.CODE, false, false, false); assertThat(codeCaptor.getValue()).isEqualTo(REQUEST_CODE_LOGIN_DEFAULT); }