OAuthController implements OAuthWebViewClient.Listener { protected void handleAuthError(int resultCode, TwitterAuthException error) { final Intent data = new Intent(); data.putExtra(AuthHandler.EXTRA_AUTH_ERROR, error); listener.onComplete(resultCode, data); } OAuthController(ProgressBar spinner, WebView webView, TwitterAuthConfig authConfig,
            OAuth1aService oAuth1aService, Listener listener); @Override void onPageFinished(WebView webView, String url); @Override void onSuccess(Bundle bundle); @Override void onError(WebViewException exception);  }
@Test public void testHandleAuthError() { final TwitterAuthException mockException = mock(TwitterAuthException.class); controller.handleAuthError(AuthHandler.RESULT_CODE_ERROR, mockException); final ArgumentCaptor<Intent> intentArgCaptor = ArgumentCaptor.forClass(Intent.class); verify(mockListener).onComplete(eq(AuthHandler.RESULT_CODE_ERROR), intentArgCaptor.capture()); final Intent data = intentArgCaptor.getValue(); assertEquals(mockException, data.getSerializableExtra(AuthHandler.EXTRA_AUTH_ERROR)); }