@Test public void testGetToken_notSuccessful() { mockNotSuccessfulTokenResult(new IllegalStateException()); when(mockFirebaseUser.getToken(true)) .thenReturn(mockGetTokenTaskResult); TestObserver<String> obs = TestObserver.create(); RxFirebaseUser.getToken(mockFirebaseUser, true) .subscribe(obs); callOnComplete(mockGetTokenTaskResult); obs.dispose(); callOnComplete(mockGetTokenTaskResult); obs.assertError(IllegalStateException.class); }
@CheckReturnValue @NonNull public static Single<String> getToken(@NonNull final FirebaseUser user, final boolean forceRefresh) { return RxTask.single(new Callable<Task<GetTokenResult>>() { @Override public Task<GetTokenResult> call() throws Exception { return user.getToken(forceRefresh); } }) .map(new Function<GetTokenResult, String>() { @Override public String apply(@NonNull GetTokenResult getTokenResult) throws Exception { return getTokenResult.getToken(); } }); }
RxFirebaseUser { @CheckReturnValue @NonNull public static Single<String> getToken(@NonNull final FirebaseUser user, final boolean forceRefresh) { return RxTask.single(new Callable<Task<GetTokenResult>>() { @Override public Task<GetTokenResult> call() throws Exception { return user.getToken(forceRefresh); } }) .map(new Function<GetTokenResult, String>() { @Override public String apply(@NonNull GetTokenResult getTokenResult) throws Exception { return getTokenResult.getToken(); } }); } }
RxFirebaseUser { @CheckReturnValue @NonNull public static Single<String> getToken(@NonNull final FirebaseUser user, final boolean forceRefresh) { return RxTask.single(new Callable<Task<GetTokenResult>>() { @Override public Task<GetTokenResult> call() throws Exception { return user.getToken(forceRefresh); } }) .map(new Function<GetTokenResult, String>() { @Override public String apply(@NonNull GetTokenResult getTokenResult) throws Exception { return getTokenResult.getToken(); } }); } private  RxFirebaseUser(); }
RxFirebaseUser { @CheckReturnValue @NonNull public static Single<String> getToken(@NonNull final FirebaseUser user, final boolean forceRefresh) { return RxTask.single(new Callable<Task<GetTokenResult>>() { @Override public Task<GetTokenResult> call() throws Exception { return user.getToken(forceRefresh); } }) .map(new Function<GetTokenResult, String>() { @Override public String apply(@NonNull GetTokenResult getTokenResult) throws Exception { return getTokenResult.getToken(); } }); } private  RxFirebaseUser(); @CheckReturnValue @NonNull static Completable delete(@NonNull final FirebaseUser user); @CheckReturnValue @NonNull static Single<String> getToken(@NonNull final FirebaseUser user,
                                          final boolean forceRefresh); @CheckReturnValue @NonNull static Single<FirebaseUser> linkWithCredential(
            @NonNull final FirebaseUser user, @NonNull final AuthCredential credential); @CheckReturnValue @NonNull static Completable reauthenticate(
            @NonNull final FirebaseUser user, @NonNull final AuthCredential credential); @CheckReturnValue @NonNull static Completable reload(@NonNull final FirebaseUser user); @CheckReturnValue @NonNull static Completable sendEmailVerification(@NonNull final FirebaseUser user); @CheckReturnValue @NonNull static Single<FirebaseUser> unlink(
            @NonNull final FirebaseUser user, @NonNull final String provider); @CheckReturnValue @NonNull static Completable updateEmail(
            @NonNull final FirebaseUser user, @NonNull final String email); @CheckReturnValue @NonNull static Completable updatePassword(
            @NonNull final FirebaseUser user, @NonNull final String password); @CheckReturnValue @NonNull static Completable updateProfile(
            @NonNull final FirebaseUser user, @NonNull final UserProfileChangeRequest request); }
RxFirebaseUser { @CheckReturnValue @NonNull public static Single<String> getToken(@NonNull final FirebaseUser user, final boolean forceRefresh) { return RxTask.single(new Callable<Task<GetTokenResult>>() { @Override public Task<GetTokenResult> call() throws Exception { return user.getToken(forceRefresh); } }) .map(new Function<GetTokenResult, String>() { @Override public String apply(@NonNull GetTokenResult getTokenResult) throws Exception { return getTokenResult.getToken(); } }); } private  RxFirebaseUser(); @CheckReturnValue @NonNull static Completable delete(@NonNull final FirebaseUser user); @CheckReturnValue @NonNull static Single<String> getToken(@NonNull final FirebaseUser user,
                                          final boolean forceRefresh); @CheckReturnValue @NonNull static Single<FirebaseUser> linkWithCredential(
            @NonNull final FirebaseUser user, @NonNull final AuthCredential credential); @CheckReturnValue @NonNull static Completable reauthenticate(
            @NonNull final FirebaseUser user, @NonNull final AuthCredential credential); @CheckReturnValue @NonNull static Completable reload(@NonNull final FirebaseUser user); @CheckReturnValue @NonNull static Completable sendEmailVerification(@NonNull final FirebaseUser user); @CheckReturnValue @NonNull static Single<FirebaseUser> unlink(
            @NonNull final FirebaseUser user, @NonNull final String provider); @CheckReturnValue @NonNull static Completable updateEmail(
            @NonNull final FirebaseUser user, @NonNull final String email); @CheckReturnValue @NonNull static Completable updatePassword(
            @NonNull final FirebaseUser user, @NonNull final String password); @CheckReturnValue @NonNull static Completable updateProfile(
            @NonNull final FirebaseUser user, @NonNull final UserProfileChangeRequest request);  }