WordnetPresenter implements MeaningPresenter { public void onDownloadClicked() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { contextHelper.openDictionariesActivity(); controller.onDownloadClicked(); }else { contextHelper.startDownload(Constants.WORDNET); } } @Inject  WordnetPresenter(WordnetDictionary dictionary, MeaningsController controller, ContextHelper contextHelper); @Override void addView(View view); @Override void dropView(); @Override void onWordUpdated(String word); void onDownloadClicked();  }
@Test public void testDownloadClicked() throws Exception { presenter.onDownloadClicked(); verify(contextHelper).startDownload(Constants.WORDNET); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { verify(controller).onDownloadClicked(); } else { verify(controller, never()).onDownloadClicked(); } }