LoginActivity extends Activity { void onError(@NonNull AuthenticationError error) { Intent data = new Intent(); data.putExtra(LoginManager.EXTRA_ERROR, error.toStandardString()); setResult(RESULT_CANCELED, data); finish(); }  @NonNull static Intent newIntent(
            @NonNull Context context,
            @NonNull SessionConfiguration sessionConfiguration,
            @NonNull ResponseType responseType); @NonNull static Intent newIntent(
            @NonNull Context context,
            @NonNull SessionConfiguration sessionConfiguration,
            @NonNull ResponseType responseType,
            boolean forceWebview); static Intent newResponseIntent(Context context, Uri responseUri);  }
@Test public void onError_shouldReturnErrorResultIntent() { ShadowActivity shadowActivity = shadowOf(loginActivity); loginActivity.onError(AuthenticationError.MISMATCHING_REDIRECT_URI); assertThat(shadowActivity.getResultIntent()).isNotNull(); assertThat(shadowActivity.getResultCode()).isEqualTo(Activity.RESULT_CANCELED); assertThat(getErrorFromIntent(shadowActivity.getResultIntent())) .isEqualTo(AuthenticationError.MISMATCHING_REDIRECT_URI); assertThat(shadowActivity.isFinishing()).isTrue(); }