MainPresenter extends BasePresenter<MainMvpView> { public void signOut() { checkViewAttached(); mDataManager.signOut() .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Completable.CompletableSubscriber() { @Override public void onCompleted() { getMvpView().launchWelcomeActivity(); } @Override public void onError(Throwable error) { getMvpView().launchWelcomeActivity(); Timber.e(error, "There was an error performing sign out"); } @Override public void onSubscribe(Subscription subscription) { mCompositeSubscription.add(subscription); } }); } @Inject  MainPresenter(DataManager dataManager, RxEventBus rxEventBus); @Override void attachView(MainMvpView mvpView); @Override void detachView(); void getAccountData(); void signOut();  }
@Test public void signOutLaunchesWelcomeActivity() { stubDataManagerSignOut(); mMainPresenter.signOut(); verify(mMockMainMvpView).launchWelcomeActivity(); }