LoginPresenter extends BasePresenter<LoginPresenter.ViewContract> implements Bundleable { public void login() { showLoading(); loginInteractor.login(username, password).observeOn(AndroidSchedulers.mainThread()).subscribe(result -> { hideLoading(); if(result) { view.handleLoginSuccess(); } else { view.handleLoginError(); } }); } @Inject  LoginPresenter(); void updateUsername(String username); void updatePassword(String password); void login(); @Override Bundle toBundle(); @Override void fromBundle(@Nullable Bundle bundle);  }
@Test public void loginCallsInteractor() throws Exception { loginPresenter.username = "Hello"; loginPresenter.password = "World"; loginPresenter.loginInteractor = loginInteractor; PresenterUtils.setView(loginPresenter, viewContract); Single<Boolean> task = Mockito.mock(Single.class); Mockito.when(loginInteractor.login("Hello", "World")).thenReturn(task); loginPresenter.login(); Mockito.verify(loginInteractor).login("Hello", "World"); }