RxFirebaseAuth { @CheckReturnValue @NonNull public static Maybe<FirebaseUser> getCurrentUser( @NonNull final FirebaseAuth instance) { return Maybe.create(new GetCurrentUserOnSubscribe(instance)); } 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 testGetCurrentUser_notSignedIn() { when(mockFirebaseAuth.getCurrentUser()) .thenReturn(null); TestObserver<FirebaseUser> obs = TestObserver.create(); RxFirebaseAuth.getCurrentUser(mockFirebaseAuth) .subscribe(obs); verify(mockFirebaseAuth) .getCurrentUser(); obs.dispose(); obs.assertComplete(); obs.assertNoValues(); }
@Test public void testGetCurrentUser_signedIn() { when(mockFirebaseUser.getDisplayName()) .thenReturn("John Doe"); when(mockFirebaseAuth.getCurrentUser()) .thenReturn(mockFirebaseUser); TestObserver<FirebaseUser> obs = TestObserver.create(); RxFirebaseAuth.getCurrentUser(mockFirebaseAuth) .subscribe(obs); verify(mockFirebaseAuth) .getCurrentUser(); obs.dispose(); obs.assertComplete(); obs.assertValueCount(1); obs.assertValue(new Predicate<FirebaseUser>() { @Override public boolean test(FirebaseUser user) throws Exception { return "John Doe".equals(user.getDisplayName()); } }); }