@Test public void saveWithNoneUniqueTCKN() throws Exception { final DoctorManagerResult result = new DoctorManagerResult(); result.setSuccess(false); result.addError(DoctorManagerError.TCKN_HAS_EXIST); initializeDoctorFacadeMock(result); addDoctorBean.save(); verifyFacesMessage(DoctorAddBean.TCKN_HAS_EXIST); }
public void save() { final FacesContext context = FacesContext.getCurrentInstance(); if (!checkFields(context)) { return; } final DoctorManagerResult result = doctorFacade.add(doctor); if (!result.isSuccess()) { if (result.getErrors().contains(DoctorManagerError.TCKN_HAS_EXIST)) { LOGGER.info("Duplicate doctor with TCKN {}", getDoctor() .getTckn()); context.addMessage(null, TCKN_HAS_EXIST); initializeDoctor(); } } else { SUCCESS.setSummary(String.format(SAVED_MSG_PATTERN, doctor.getTckn(), doctor.getName(), doctor.getSurname(), SAVED_MSG)); LOGGER.info("The new doctor {} has been saved", doctor.getFullname()); context.addMessage(null, SUCCESS); initializeDoctor(); } }
DoctorAddBean implements Serializable { public void save() { final FacesContext context = FacesContext.getCurrentInstance(); if (!checkFields(context)) { return; } final DoctorManagerResult result = doctorFacade.add(doctor); if (!result.isSuccess()) { if (result.getErrors().contains(DoctorManagerError.TCKN_HAS_EXIST)) { LOGGER.info("Duplicate doctor with TCKN {}", getDoctor() .getTckn()); context.addMessage(null, TCKN_HAS_EXIST); initializeDoctor(); } } else { SUCCESS.setSummary(String.format(SAVED_MSG_PATTERN, doctor.getTckn(), doctor.getName(), doctor.getSurname(), SAVED_MSG)); LOGGER.info("The new doctor {} has been saved", doctor.getFullname()); context.addMessage(null, SUCCESS); initializeDoctor(); } } }
DoctorAddBean implements Serializable { public void save() { final FacesContext context = FacesContext.getCurrentInstance(); if (!checkFields(context)) { return; } final DoctorManagerResult result = doctorFacade.add(doctor); if (!result.isSuccess()) { if (result.getErrors().contains(DoctorManagerError.TCKN_HAS_EXIST)) { LOGGER.info("Duplicate doctor with TCKN {}", getDoctor() .getTckn()); context.addMessage(null, TCKN_HAS_EXIST); initializeDoctor(); } } else { SUCCESS.setSummary(String.format(SAVED_MSG_PATTERN, doctor.getTckn(), doctor.getName(), doctor.getSurname(), SAVED_MSG)); LOGGER.info("The new doctor {} has been saved", doctor.getFullname()); context.addMessage(null, SUCCESS); initializeDoctor(); } }  }
DoctorAddBean implements Serializable { public void save() { final FacesContext context = FacesContext.getCurrentInstance(); if (!checkFields(context)) { return; } final DoctorManagerResult result = doctorFacade.add(doctor); if (!result.isSuccess()) { if (result.getErrors().contains(DoctorManagerError.TCKN_HAS_EXIST)) { LOGGER.info("Duplicate doctor with TCKN {}", getDoctor() .getTckn()); context.addMessage(null, TCKN_HAS_EXIST); initializeDoctor(); } } else { SUCCESS.setSummary(String.format(SAVED_MSG_PATTERN, doctor.getTckn(), doctor.getName(), doctor.getSurname(), SAVED_MSG)); LOGGER.info("The new doctor {} has been saved", doctor.getFullname()); context.addMessage(null, SUCCESS); initializeDoctor(); } }  @PostConstruct void setUp(); void save(); Doctor getDoctor(); void setDoctor(final Doctor doctor); boolean isEnable(); void setEnable(final boolean enable); String getPasswordConfirm(); void setPasswordConfirm(final String passwordConfirm); DoctorTitle[] getDoctorTitles(); void setDoctorFacade(final DoctorFacade doctorFacade); void setNotificationSettingFacade(
            final NotificationSettingFacade notificationSettingFacade); }
DoctorAddBean implements Serializable { public void save() { final FacesContext context = FacesContext.getCurrentInstance(); if (!checkFields(context)) { return; } final DoctorManagerResult result = doctorFacade.add(doctor); if (!result.isSuccess()) { if (result.getErrors().contains(DoctorManagerError.TCKN_HAS_EXIST)) { LOGGER.info("Duplicate doctor with TCKN {}", getDoctor() .getTckn()); context.addMessage(null, TCKN_HAS_EXIST); initializeDoctor(); } } else { SUCCESS.setSummary(String.format(SAVED_MSG_PATTERN, doctor.getTckn(), doctor.getName(), doctor.getSurname(), SAVED_MSG)); LOGGER.info("The new doctor {} has been saved", doctor.getFullname()); context.addMessage(null, SUCCESS); initializeDoctor(); } }  @PostConstruct void setUp(); void save(); Doctor getDoctor(); void setDoctor(final Doctor doctor); boolean isEnable(); void setEnable(final boolean enable); String getPasswordConfirm(); void setPasswordConfirm(final String passwordConfirm); DoctorTitle[] getDoctorTitles(); void setDoctorFacade(final DoctorFacade doctorFacade); void setNotificationSettingFacade(
            final NotificationSettingFacade notificationSettingFacade); static final String TCKN_HAS_EXIST_MSG; static final String INVALID_EMAIL_MSG; static final String PASSWORDS_DONT_MATH_MSG; static final String INVALID_TCKN_MSG; }