### Question:
UserPresenter { public void getUserName() { disposable = nameRepository .getName() .timeout(2, TimeUnit.SECONDS) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe( name -> { listener.onUserNameLoaded(name); if (BuildConfig.DEBUG) { logger.info(String.format("Name loaded: %s", name)); } }, error -> listener.onGettingUserNameError(error.getMessage())); } UserPresenter(Listener listener, NameRepository nameRepository, Logger logger); void getUserName(); void stopLoading();  }### Answer:
@Test public void getUserName() { presenter.getUserName(); timeoutRule.getTestScheduler().advanceTimeBy(TIMEOUT_SEC - 1, TimeUnit.SECONDS); nameObservable.onNext(NAME); verify(listener).onUserNameLoaded(NAME); }
@Test public void getUserName_timeout() { presenter.getUserName(); timeoutRule.getTestScheduler().advanceTimeBy(TIMEOUT_SEC + 1, TimeUnit.SECONDS); nameObservable.onNext(NAME); verify(listener).onGettingUserNameError(any()); }