MainPresenter { @Nonnull Observable<String> titleObservable() { return titleObservable; } MainPresenter(@Nonnull final PostsDao postsDao,
                         @Nonnull final MyCurrentLoggedInUserDao currentLoggedInUserDao,
                         @Nonnull Scheduler uiScheduler);   }
@Test public void testAfterSuccessDownload_titleIsSet() throws Exception { final TestSubscriber<String> title = new TestSubscriber<>(); mainPresenter.titleObservable().subscribe(title); postsSubject.onNext(sampleData()); scheduler.triggerActions(); assert_().that(title.getOnNextEvents()) .contains("some_title"); title.assertNoErrors(); }
@Test public void testBeforeDownload_titleIsNotSet() throws Exception { final TestSubscriber<String> title = new TestSubscriber<>(); mainPresenter.titleObservable().subscribe(title); assert_().that(title.getOnNextEvents()) .isEmpty(); title.assertNoErrors(); }