SentenceListPresenter extends AbstractMvpPresenter<SentenceList.View, SentenceListViewModel> implements SentenceList.Presenter<SentenceList.View, SentenceListViewModel> { @Override public void openSentence(long sentenceId) { mView.showSentence(sentenceId); setNeedAutoFocused(true); getEventBus().post(new UpdateManualFetchFabEvent(false)); } SentenceListPresenter(); void setLoadSentencesUCAndHandler(LoadSentencesUC loadSentencesUC, UseCaseHandler useCaseHandler); void setUpdateFavoriteSentenceUCAndHandler(UpdateFavoriteSentenceUC updateFavoriteSentenceUC, UseCaseHandler useCaseHandler); @Override void loadSentences(final boolean firstLoad); @Override void openSentence(long sentenceId); @Override void setFavorite(@NonNull Sentence sentence, boolean favorite); @Override void onCreate(); @Override void onActivityCreated(); @Subscribe @Override void onSentenceChanged(SentenceChangedEvent event); @Override void setNeedAutoFocused(boolean needAutoFocused); @Override void onDestroy(); @VisibleForTesting EventBus getEventBus();  }
@Test public void testOpenSentence() { mSentenceListPresenter.openSentence(1L); verify(mView).showSentence(1L); assertTrue(mModel.isNeedAutoFocused()); verify(mEventBus).post(mUpdateManualFetchFabEventCaptor.capture()); assertFalse(mUpdateManualFetchFabEventCaptor.getValue().getVisible()); }