MainActivityPresenter implements DialogInterface.OnClickListener { public void onWarningTextClick() { String text = mainActivityView.getWarningText(); if (text.equals(Constants.PAUSE_WARNING_MESSAGE_FIRST)) { mainActivityView.setWarningText(Constants.PAUSE_WARNING_MESSAGE_SECOND); } else { mainActivityView.hideWarningText(); mainActivityView.showTimingGrid(); } } @Inject  MainActivityPresenter(Set<String> activatedPackages, SharedPreferences sharedPreferences,
      Context context, AccessibilityChecker accessibilityChecker); void setView(MainActivityView mainActivityView); void checkAccessibilityEnabled(); void onAppLockActivateClick(); void onTimingClick(String timing); void onWarningTextClick(); void onCreditTextClick(); void onGithubClick(); @Override void onClick(DialogInterface dialog, int which);  }
@Test public void testOnWarningTextClick() throws Exception { given(mainActivityView.getWarningText()).willReturn(Constants.PAUSE_WARNING_MESSAGE_FIRST); mainActivityPresenter.onWarningTextClick(); verify(mainActivityView).setWarningText(Constants.PAUSE_WARNING_MESSAGE_SECOND); given(mainActivityView.getWarningText()).willReturn(Constants.PAUSE_WARNING_MESSAGE_SECOND); mainActivityPresenter.onWarningTextClick(); verify(mainActivityView).hideWarningText(); verify(mainActivityView).showTimingGrid(); }