LoginManager { @NonNull public Session<?> getSession() { if (sessionConfiguration.getServerToken() != null) { return new ServerTokenSession(sessionConfiguration); } else if (accessTokenStorage.getAccessToken() != null) { return new AccessTokenSession(sessionConfiguration, accessTokenStorage); } else { throw new IllegalStateException("Tried to call getSession but not logged in or server token set."); } } 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 getSession_withAccessToken_successful() { when(accessTokenStorage.getAccessToken()).thenReturn(ACCESS_TOKEN); Session session = loginManager.getSession(); assertEquals(ACCESS_TOKEN, ((AccessTokenAuthenticator) session.getAuthenticator()).getTokenStorage().getAccessToken()); }
@Test(expected = IllegalStateException.class) public void getSession_withoutAccessTokenOrToken_fails() { when(accessTokenStorage.getAccessToken()).thenReturn(null); loginManager.getSession(); }