TwitterAuthClient { public void onActivityResult(int requestCode, int resultCode, Intent data) { Twitter.getLogger().d(TwitterCore.TAG, "onActivityResult called with " + requestCode + " " + resultCode); if (!authState.isAuthorizeInProgress()) { Twitter.getLogger().e(TwitterCore.TAG, "Authorize not in progress", null); } else { final AuthHandler authHandler = authState.getAuthHandler(); if (authHandler != null && authHandler.handleOnActivityResult(requestCode, resultCode, data)) { authState.endAuthorize(); } } } TwitterAuthClient();   TwitterAuthClient(TwitterCore twitterCore, TwitterAuthConfig authConfig,
                      SessionManager<TwitterSession> sessionManager, AuthState authState); int getRequestCode(); void authorize(Activity activity, Callback<TwitterSession> callback); void cancelAuthorize(); void onActivityResult(int requestCode, int resultCode, Intent data); void requestEmail(TwitterSession session, final Callback<String> callback);  }
@Test public void testOnActivityResult_noAuthorizeInProgress() { when(mockAuthState.isAuthorizeInProgress()).thenReturn(false); authClient.onActivityResult(TEST_REQUEST_CODE, Activity.RESULT_OK, mock(Intent.class)); verify(mockAuthState).isAuthorizeInProgress(); verifyNoMoreInteractions(mockAuthState); }
@Test public void testOnActivityResult_handleOnActivityResultTrue() { setUpAuthStateOnActivityResult(true); authClient.onActivityResult(TEST_REQUEST_CODE, Activity.RESULT_OK, mock(Intent.class)); verify(mockAuthState).isAuthorizeInProgress(); verify(mockAuthState).getAuthHandler(); verify(mockAuthState).endAuthorize(); }
@Test public void testOnActivityResult_handleOnActivityResultFalse() { setUpAuthStateOnActivityResult(false); authClient.onActivityResult(TEST_REQUEST_CODE, Activity.RESULT_OK, mock(Intent.class)); verify(mockAuthState).isAuthorizeInProgress(); verify(mockAuthState).getAuthHandler(); verifyNoMoreInteractions(mockAuthState); }