CreatePostPresenter { @Nonnull Observable<Boolean> progressObservable() { return showProgress; } CreatePostPresenter(@Nonnull final PostsDao postsDao,
                               @Nonnull final Scheduler uiScheduler);   }
@Test public void testAfterStart_progressBarIsHidden() throws Exception { final TestSubscriber<Boolean> showProgress = new TestSubscriber<>(); postPresenter.progressObservable().subscribe(showProgress); assert_().that(showProgress.getOnNextEvents()).isEqualTo(ImmutableList.of(false)); }
@Test public void testAfterFillingDataAndClickSend_progressBarIsShowed() throws Exception { final TestSubscriber<Object> showProgress = new TestSubscriber<>(); postPresenter.progressObservable().subscribe(showProgress); fillDataAndSubmit(); assert_().that(showProgress.getOnNextEvents()).isEqualTo(ImmutableList.of(false, true)); }
@Test public void testAfterSaveSucces_progressBarIsHidden() throws Exception { final TestSubscriber<Object> hideProgressBar = new TestSubscriber<>(); postPresenter.progressObservable().subscribe(hideProgressBar); fillDataAndSubmit(); returnCorrectResponse(); assert_().that(hideProgressBar.getOnNextEvents()).isEqualTo(ImmutableList.of(false,true,false)); }
@Test public void testAfterSaveFail_progressBarIsHidden() throws Exception { final TestSubscriber<Object> hideProgressBar = new TestSubscriber<>(); postPresenter.progressObservable().subscribe(hideProgressBar); fillDataAndSubmit(); returnException(); assert_().that(hideProgressBar.getOnNextEvents()).isEqualTo(ImmutableList.of(false,true,false)); }