@Test public void validate() { Step8Action action = getTestAction(); assertFalse(action.isReadAndUnderstood()); assertFalse(action.isConsented()); assertFalse(action.isWithdrawal()); assertNull(action.getToday()); assertTrue(StringUtils.isEmpty(action.getFirstName())); assertTrue(StringUtils.isEmpty(action.getLastName())); action.validate(); assertTrue(action.hasFieldErrors()); assertEquals(6, action.getFieldErrors().size()); assertNotNull(action.getFieldErrors().get("readAndUnderstood")); assertNotNull(action.getFieldErrors().get("consented")); assertNotNull(action.getFieldErrors().get("withdrawal")); assertNotNull(action.getFieldErrors().get("firstName")); assertNotNull(action.getFieldErrors().get("lastName")); assertNotNull(action.getFieldErrors().get("today")); action.clearErrorsAndMessages(); action.setReadAndUnderstood(true); action.setConsented(true); action.setWithdrawal(true); action.setFirstName("Test"); action.setLastName("User"); action.setToday(new Date()); action.validate(); assertFalse(action.hasFieldErrors()); }
@Override public void validate() { validateUnderstanding(); if (today == null) { addFieldError("today", getText(FIELD_REQUIRED_KEY)); } if (StringUtils.isEmpty(firstName)) { addFieldError("firstName", getText(FIELD_REQUIRED_KEY)); } if (StringUtils.isEmpty(lastName)) { addFieldError("lastName", getText(FIELD_REQUIRED_KEY)); } }
Step8Action extends ConsentWizardAction { @Override public void validate() { validateUnderstanding(); if (today == null) { addFieldError("today", getText(FIELD_REQUIRED_KEY)); } if (StringUtils.isEmpty(firstName)) { addFieldError("firstName", getText(FIELD_REQUIRED_KEY)); } if (StringUtils.isEmpty(lastName)) { addFieldError("lastName", getText(FIELD_REQUIRED_KEY)); } } }
Step8Action extends ConsentWizardAction { @Override public void validate() { validateUnderstanding(); if (today == null) { addFieldError("today", getText(FIELD_REQUIRED_KEY)); } if (StringUtils.isEmpty(firstName)) { addFieldError("firstName", getText(FIELD_REQUIRED_KEY)); } if (StringUtils.isEmpty(lastName)) { addFieldError("lastName", getText(FIELD_REQUIRED_KEY)); } }  }
Step8Action extends ConsentWizardAction { @Override public void validate() { validateUnderstanding(); if (today == null) { addFieldError("today", getText(FIELD_REQUIRED_KEY)); } if (StringUtils.isEmpty(firstName)) { addFieldError("firstName", getText(FIELD_REQUIRED_KEY)); } if (StringUtils.isEmpty(lastName)) { addFieldError("lastName", getText(FIELD_REQUIRED_KEY)); } }  @Override void validate(); boolean isReadAndUnderstood(); void setReadAndUnderstood(boolean readAndUnderstood); boolean isConsented(); void setConsented(boolean consented); boolean isWithdrawal(); void setWithdrawal(boolean withdrawal); String getFirstName(); void setFirstName(String firstName); String getLastName(); void setLastName(String lastName); Date getToday(); void setToday(Date today); }
Step8Action extends ConsentWizardAction { @Override public void validate() { validateUnderstanding(); if (today == null) { addFieldError("today", getText(FIELD_REQUIRED_KEY)); } if (StringUtils.isEmpty(firstName)) { addFieldError("firstName", getText(FIELD_REQUIRED_KEY)); } if (StringUtils.isEmpty(lastName)) { addFieldError("lastName", getText(FIELD_REQUIRED_KEY)); } }  @Override void validate(); boolean isReadAndUnderstood(); void setReadAndUnderstood(boolean readAndUnderstood); boolean isConsented(); void setConsented(boolean consented); boolean isWithdrawal(); void setWithdrawal(boolean withdrawal); String getFirstName(); void setFirstName(String firstName); String getLastName(); void setLastName(String lastName); Date getToday(); void setToday(Date today);  }