OAuthHandler extends AuthHandler { @Override public boolean authorize(Activity activity) { activity.startActivityForResult(newIntent(activity), requestCode); return true; } OAuthHandler(TwitterAuthConfig authConfig, Callback<TwitterSession> callback,
            int requestCode); @Override boolean authorize(Activity activity);  }
@Test public void testAuthorize() { final Activity mockActivity = mock(Activity.class); doNothing().when(mockActivity).startActivityForResult(any(Intent.class), anyInt()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { doNothing().when(mockActivity).startActivityForResult(any(Intent.class), anyInt(), any(Bundle.class)); } authHandler.authorize(mockActivity); verify(mockActivity).startActivityForResult(any(Intent.class), eq(REQUEST_CODE)); }