@Test public void ShouldAskForWarning_WhenAgeIsAbove120() throws Exception { presenter.onNextClicked("121", null, null, null, -1, null); verify(helloViewMock).displayErrorWrongAge(); verify(dbHandlerMock, never()).addUser(any(User.class)); }
public void onNextClicked(String age, String gender, String language, String country, int type, String unit) { if (validateAge(age)) { saveToDatabase(id, name, language, country, Integer.parseInt(age), gender, type, unit); helloView.startMainView(); } else { helloView.displayErrorWrongAge(); } }
HelloPresenter { public void onNextClicked(String age, String gender, String language, String country, int type, String unit) { if (validateAge(age)) { saveToDatabase(id, name, language, country, Integer.parseInt(age), gender, type, unit); helloView.startMainView(); } else { helloView.displayErrorWrongAge(); } } }
HelloPresenter { public void onNextClicked(String age, String gender, String language, String country, int type, String unit) { if (validateAge(age)) { saveToDatabase(id, name, language, country, Integer.parseInt(age), gender, type, unit); helloView.startMainView(); } else { helloView.displayErrorWrongAge(); } } HelloPresenter(final HelloView helloView, final DatabaseHandler dbHandler); }
HelloPresenter { public void onNextClicked(String age, String gender, String language, String country, int type, String unit) { if (validateAge(age)) { saveToDatabase(id, name, language, country, Integer.parseInt(age), gender, type, unit); helloView.startMainView(); } else { helloView.displayErrorWrongAge(); } } HelloPresenter(final HelloView helloView, final DatabaseHandler dbHandler); void loadDatabase(); void onNextClicked(String age, String gender, String language, String country, int type, String unit); }
HelloPresenter { public void onNextClicked(String age, String gender, String language, String country, int type, String unit) { if (validateAge(age)) { saveToDatabase(id, name, language, country, Integer.parseInt(age), gender, type, unit); helloView.startMainView(); } else { helloView.displayErrorWrongAge(); } } HelloPresenter(final HelloView helloView, final DatabaseHandler dbHandler); void loadDatabase(); void onNextClicked(String age, String gender, String language, String country, int type, String unit);  }