CreatePostPresenter { @Nonnull Observable<Throwable> postErrorObservable() { return addPostResult .compose(ResponseOrError.<PostWithBody>onlyError()); } CreatePostPresenter(@Nonnull final PostsDao postsDao,
                               @Nonnull final Scheduler uiScheduler);   }
@Test public void testAfterSaveSuccess_doNotShowError() throws Exception { final TestSubscriber<Object> showError = new TestSubscriber<>(); postPresenter.postErrorObservable().subscribe(showError); fillDataAndSubmit(); returnCorrectResponse(); assert_().that(showError.getOnNextEvents()).isEmpty(); }
@Test public void testAfterSaveFail_showError() throws Exception { final TestSubscriber<Object> showError = new TestSubscriber<>(); postPresenter.postErrorObservable().subscribe(showError); fillDataAndSubmit(); returnException(); assert_().that(showError.getOnNextEvents()).hasSize(1); }