@Test public void testPrepare() throws Exception { MockServletContext context = (MockServletContext) ServletActionContext.getServletContext(); context.addInitParameter("some.other.param", "false"); registrationAction.prepare(); assertEquals(2, registrationAction.getStateList().size()); assertEquals(1, registrationAction.getCountryList().size()); }
@Test public void testValidate() throws Exception { RegistrationRequest request = new RegistrationRequest(); request.setLoginName("login"); request.setEmail("*****@*****.**"); registrationAction.setRegistrationRequest(request); registrationAction.prepare(); registrationAction.validate(); MockServletContext context = new MockServletContext(); context.addInitParameter("ldap.install", "true"); ServletActionContext.setServletContext(context); registrationAction.prepare(); registrationAction.validate(); registrationAction.setLdapAuthenticate(false); registrationAction.validate(); }
@Override public void prepare() { super.prepare(); buildHospitalList(); setDifferentActionsForRole(); }