Search in sources :

Example 6 with FirebaseAuthException

use of com.google.firebase.auth.FirebaseAuthException in project FirebaseUI-Android by firebase.

the class SocialProviderResponseHandlerTest method testSignInIdp_disabled.

@Test
public void testSignInIdp_disabled() {
    mHandler.getOperation().observeForever(mResultObserver);
    when(mMockAuth.signInWithCredential(any(AuthCredential.class))).thenReturn(AutoCompleteTask.forFailure(new FirebaseAuthException("ERROR_USER_DISABLED", "disabled")));
    IdpResponse response = new IdpResponse.Builder(new User.Builder(GoogleAuthProvider.PROVIDER_ID, TestConstants.EMAIL).build()).setToken(TestConstants.TOKEN).build();
    mHandler.startSignIn(response);
    verify(mResultObserver).onChanged(argThat(ResourceMatchers.isFailureWithCode(ErrorCodes.ERROR_USER_DISABLED)));
}
Also used : AuthCredential(com.google.firebase.auth.AuthCredential) FirebaseAuthException(com.google.firebase.auth.FirebaseAuthException) IdpResponse(com.firebase.ui.auth.IdpResponse) Test(org.junit.Test)

Aggregations

FirebaseAuthException (com.google.firebase.auth.FirebaseAuthException)6 IdpResponse (com.firebase.ui.auth.IdpResponse)5 FirebaseUiException (com.firebase.ui.auth.FirebaseUiException)4 FirebaseAuthError (com.firebase.ui.auth.util.FirebaseAuthError)4 FirebaseAuthAnonymousUpgradeException (com.firebase.ui.auth.FirebaseAuthAnonymousUpgradeException)3 Resource (com.firebase.ui.auth.data.model.Resource)3 AuthCredential (com.google.firebase.auth.AuthCredential)3 Activity (android.app.Activity)2 Application (android.app.Application)2 Intent (android.content.Intent)2 NonNull (androidx.annotation.NonNull)2 Nullable (androidx.annotation.Nullable)2 RestrictTo (androidx.annotation.RestrictTo)2 ErrorCodes (com.firebase.ui.auth.ErrorCodes)2 User (com.firebase.ui.auth.data.model.User)2 AuthOperationManager (com.firebase.ui.auth.util.data.AuthOperationManager)2 ProviderUtils (com.firebase.ui.auth.util.data.ProviderUtils)2 RequestCodes (com.firebase.ui.auth.viewmodel.RequestCodes)2 OnFailureListener (com.google.android.gms.tasks.OnFailureListener)2 OnSuccessListener (com.google.android.gms.tasks.OnSuccessListener)2