@Test public void ShouldPropagateAllValues_WhenSavingUser() throws Exception { final String gender = "male"; final String language = "ukrainian"; final String country = "ukraine"; final int type = 1; final String unit = "mmol/l"; presenter.onNextClicked("35", gender, language, country, type, unit); verify(dbHandlerMock).addUser(userCaptor.capture()); final User user = userCaptor.getValue(); assertThat(user.getAge()).isEqualTo(35); assertThat(user.getGender()).isEqualTo(gender); assertThat(user.getPreferred_language()).isEqualTo(language); assertThat(user.getCountry()).isEqualTo(country); assertThat(user.getD_type()).isEqualTo(type); assertThat(user.getPreferred_unit()).isEqualTo(unit); }
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);  }