RxFirebaseAuth { @CheckReturnValue @NonNull public static Single<List<String>> fetchProvidersForEmail( @NonNull final FirebaseAuth instance, @NonNull final String email) { return RxTask.single(new Callable<Task<ProviderQueryResult>>() { @Override public Task<ProviderQueryResult> call() throws Exception { return instance.fetchProvidersForEmail(email); } }).map(new Function<ProviderQueryResult, List<String>>() { @Override public List<String> apply(@NonNull ProviderQueryResult providerQueryResult) throws Exception { List<String> providers = providerQueryResult.getProviders(); if (null == providers) { providers = Collections.emptyList(); } return providers; } }); } private  RxFirebaseAuth(); @CheckReturnValue @NonNull static Observable<FirebaseAuth> changes(@NonNull FirebaseAuth instance); @CheckReturnValue @NonNull static Single<FirebaseUser> createUserWithEmailAndPassword(
            @NonNull final FirebaseAuth instance,
            @NonNull final String email, @NonNull final String password); @CheckReturnValue @NonNull static Single<List<String>> fetchProvidersForEmail(
            @NonNull final FirebaseAuth instance, @NonNull final String email); @CheckReturnValue @NonNull static Maybe<FirebaseUser> getCurrentUser(
            @NonNull final FirebaseAuth instance); @CheckReturnValue @NonNull static Completable sendPasswordResetEmail(
            @NonNull final FirebaseAuth instance, @NonNull final String email); @CheckReturnValue @NonNull static Single<FirebaseUser> signInAnonymous(
            @NonNull final FirebaseAuth instance); @CheckReturnValue @NonNull static Function<AuthResult, FirebaseUser> authToUserFunction(); @CheckReturnValue @NonNull static Single<FirebaseUser> signInWithCredential(
            @NonNull final FirebaseAuth instance, @NonNull final AuthCredential credential); @CheckReturnValue @NonNull static Single<FirebaseUser> signInWithCustomToken(
            @NonNull final FirebaseAuth instance, @NonNull final String token); @CheckReturnValue @NonNull static Single<FirebaseUser> signInWithEmailAndPassword(
            @NonNull final FirebaseAuth instance,
            @NonNull final String email, @NonNull final String password); @CheckReturnValue @NonNull static Completable signOut(@NonNull final FirebaseAuth instance);  }
@Test public void testFetchProvidersForEmail() { when(mockFirebaseAuth.fetchProvidersForEmail("foo@bar.com")) .thenReturn(mockFetchProvidersTask); mockSuccessfulFetchProvidersResult(); when(mockFirebaseAuth.fetchProvidersForEmail("foo@bar.com")) .thenReturn(mockFetchProvidersTask); TestObserver<List<String>> obs = TestObserver.create(); RxFirebaseAuth .fetchProvidersForEmail(mockFirebaseAuth, "foo@bar.com") .subscribe(obs); callOnComplete(mockFetchProvidersTask); obs.dispose(); callOnComplete(mockFetchProvidersTask); obs.assertComplete(); obs.assertValueCount(1); }
@Test public void testFetchProvidersForEmail_NotSuccessful() { when(mockFirebaseAuth.fetchProvidersForEmail("foo@bar.com")) .thenReturn(mockFetchProvidersTask); mockNotSuccessfulFetchProvidersResult(new IllegalStateException()); when(mockFirebaseAuth.fetchProvidersForEmail("foo@bar.com")) .thenReturn(mockFetchProvidersTask); TestObserver<List<String>> obs = TestObserver.create(); RxFirebaseAuth .fetchProvidersForEmail(mockFirebaseAuth, "foo@bar.com") .subscribe(obs); callOnComplete(mockFetchProvidersTask); obs.dispose(); callOnComplete(mockFetchProvidersTask); obs.assertError(IllegalStateException.class); obs.assertNoValues(); }