RxLogin { public Flowable<Result<TwitterSession>> loginTwitter(Activity activity) { if (mTwitterClient == null) { mTwitterClient = new TwitterAuthClient(); } return Flowable.create(new TwitterSubscriber(this, activity, mTwitterClient), BackpressureStrategy.DROP); }  Flowable<LoginResult> loginFacebook(Activity activity, boolean publish,
        List<String> permissions); Flowable<GoogleSignInResult> loginGoogle(Activity activity, @NonNull Scope scope,
        Scope... scopes); Flowable<GoogleSignInResult> loginGoogle(Activity activity, @NonNull String
        webClientId, @NonNull Scope scope, Scope... scopes); Flowable<Result<TwitterSession>> loginTwitter(Activity activity); void registerCallback(final FacebookCallback<LoginResult> callback); void registerCallback(GoogleCallback callback); void registerCallback(Callback<TwitterSession> callback); boolean onActivityResult(int requestCode, int resultCode, Intent data);  }
@Test public void testLoginTwitterSuccess() { Result<TwitterSession> result = mock(Result.class); mRxLogin.mTwitterClient = mMockTwitterAuthClient; mRxLogin.loginTwitter(mActivity).subscribe(mTwitterSubscriber); mRxLogin.mTwitterCallback.success(result); mTwitterSubscriber.awaitTerminalEvent(); mTwitterSubscriber.assertResult(result); mTwitterSubscriber.assertComplete(); }
@Test public void testLoginTwitterError() { mRxLogin.mTwitterClient = mMockTwitterAuthClient; mRxLogin.loginTwitter(mActivity).subscribe(mTwitterSubscriber); mRxLogin.mTwitterCallback.failure(mock(TwitterException.class)); mTwitterSubscriber.awaitTerminalEvent(); mTwitterSubscriber.assertError(LoginException.class); }