RideRequestActivity extends Activity implements LoginCallback, RideRequestViewCallback { @Override public void onLoginError(@NonNull AuthenticationError error) { Intent data = new Intent(); data.putExtra(AUTHENTICATION_ERROR, error); if (AuthenticationError.CONNECTIVITY_ISSUE.equals(error)) { authenticationErrorDialog = buildRetryAlert( R.string.ub__ride_request_activity_authentication_error, R.string.ub__ride_error_try_again, android.R.string.cancel, data); } else { authenticationErrorDialog = buildErrorAlert( R.string.ub__ride_request_activity_authentication_error, android.R.string.ok, data); } authenticationErrorDialog.show(); }  @NonNull static Intent newIntent(@NonNull Context context,
            @Nullable RideParameters rideParameters,
            @NonNull SessionConfiguration loginConfiguration,
            @Nullable String accessTokenStorageKey); @Override void onCreate(Bundle savedInstanceState); @Override void onErrorReceived(@NonNull RideRequestViewError error); @Override void onLoginCancel(); @Override void onLoginError(@NonNull AuthenticationError error); @Override void onLoginSuccess(@NonNull AccessToken accessToken); @Override void onAuthorizationCodeReceived(@NonNull String authorizationCode); @Override void onRequestPermissionsResult(
            int requestCode,
            @NonNull String[] permissions,
            @NonNull int[] grantResults); static final String AUTHENTICATION_ERROR; static final String RIDE_REQUEST_ERROR; }
@Test public void onLoad_whenLoginErrorOccurs_shouldReturnErrorResultIntent() { ShadowActivity shadowActivity = shadowOf(activity); activity.onLoginError(AuthenticationError.MISMATCHING_REDIRECT_URI); ShadowAlertDialog shadowAlertDialog = shadowOf(activity.authenticationErrorDialog); String message = "There was a problem authenticating you."; assertEquals(message, shadowAlertDialog.getMessage()); activity.authenticationErrorDialog.getButton(AlertDialog.BUTTON_POSITIVE).performClick(); Assert.assertNotNull(shadowActivity.getResultIntent()); assertEquals(shadowActivity.getResultCode(), Activity.RESULT_CANCELED); assertEquals(AuthenticationError.MISMATCHING_REDIRECT_URI, shadowActivity.getResultIntent().getSerializableExtra (RideRequestActivity.AUTHENTICATION_ERROR)); }