SentenceListPresenter extends AbstractMvpPresenter<SentenceList.View, SentenceListViewModel> implements SentenceList.Presenter<SentenceList.View, SentenceListViewModel> { @Override public void onDestroy() { super.onDestroy(); getEventBus().unregister(this); getEventBus().removeStickyEvent(FocusedSentenceEvent.class); } 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 testOnDestroy() { mSentenceListPresenter.onDestroy(); verify(mEventBus).unregister(mSentenceListPresenter); verify(mEventBus).removeStickyEvent(FocusedSentenceEvent.class); }