Package com.opensymphony.xwork.validator

Examples of com.opensymphony.xwork.validator.DefaultActionValidatorManager


    assertNull(feed);
  }
 
  @SuppressWarnings("unchecked")
  public void testValidationURLMissing() throws Exception{
    DefaultActionValidatorManager validator = new DefaultActionValidatorManager();
    validator.validate(action, "create");
    assertTrue(action.hasFieldErrors());
    Map<String, Object> errors = action.getFieldErrors();
    assertEquals(1, errors.size());
  }
View Full Code Here


    super.tearDown();
  }

  @SuppressWarnings("unchecked")
  public void testValidationMissingUsername() throws Exception{
    DefaultActionValidatorManager validator = new DefaultActionValidatorManager();
    validator.validate(action, "createUser");
    assertTrue(action.hasFieldErrors());
    Map<String, Object> errors = action.getFieldErrors();
    assertEquals(4, errors.size());
  }
View Full Code Here

    assertEquals(4, errors.size());
  }
 
  @SuppressWarnings("unchecked")
  public void testValidationUsernameTooShort() throws Exception{
    DefaultActionValidatorManager validator = new DefaultActionValidatorManager();
    action.setUsername("ab");
    action.setPassword("poploop");
    action.setPasswordConfirm("poploop");
    action.setEmail("foo@foo.com");
    validator.validate(action, "createUser");
    assertTrue(action.hasFieldErrors());
    Map<String, Object> errors = action.getFieldErrors();
    assertEquals(1, errors.size());
  }
View Full Code Here

    assertEquals(1, errors.size());
  }
 
  @SuppressWarnings("unchecked")
  public void testValidationUsernameRegEx() throws Exception{
    DefaultActionValidatorManager validator = new DefaultActionValidatorManager();
    action.setUsername("123abc");
    action.setPassword("poploop");
    action.setPasswordConfirm("poploop");
    action.setEmail("foo@foo.com");
    validator.validate(action, "createUser");
    assertTrue(action.hasFieldErrors());
    Map<String, Object> errors = action.getFieldErrors();
    assertEquals(1, errors.size());
  }
View Full Code Here

    assertEquals(1, errors.size());
  }
 
  @SuppressWarnings("unchecked")
  public void testValidationUsernameRegEx2() throws Exception{
    DefaultActionValidatorManager validator = new DefaultActionValidatorManager();
    action.setUsername("abc_30");
    action.setPassword("poploop");
    action.setPasswordConfirm("poploop");
    action.setEmail("foo@foo.com");
    validator.validate(action, "createUser");
    assertTrue(action.hasFieldErrors());
    Map<String, Object> errors = action.getFieldErrors();
    assertEquals(1, errors.size());
  }
View Full Code Here

    assertEquals(1, errors.size());
  }
 
  @SuppressWarnings("unchecked")
  public void testValidationUsernameRegEx3() throws Exception{
    DefaultActionValidatorManager validator = new DefaultActionValidatorManager();
    action.setUsername("abc30");
    action.setPassword("poploop");
    action.setPasswordConfirm("poploop");
    action.setEmail("foo@foo.com");
    validator.validate(action, "createUser");
    assertFalse(action.hasFieldErrors());
    Map<String, Object> errors = action.getFieldErrors();
    assertEquals(0, errors.size());
  }
View Full Code Here

    assertEquals(0, errors.size());
  }
 
  @SuppressWarnings("unchecked")
  public void testValidationUsernameTooLong() throws Exception{
    DefaultActionValidatorManager validator = new DefaultActionValidatorManager();
    action.setUsername("abc3000000000000000000000000000000000000");
    action.setPassword("poploop");
    action.setPasswordConfirm("poploop");
    action.setEmail("foo@foo.com");
    validator.validate(action, "createUser");
    assertTrue(action.hasFieldErrors());
    Map<String, Object> errors = action.getFieldErrors();
    assertEquals(1, errors.size());
  }
View Full Code Here

    assertEquals(1, errors.size());
  }
 
  @SuppressWarnings("unchecked")
  public void testValidationMissingEmail() throws Exception{
    DefaultActionValidatorManager validator = new DefaultActionValidatorManager();
    action.setUsername("abc30");
    action.setPassword("poploop");
    action.setPasswordConfirm("poploop");
    action.setEmail("");
    validator.validate(action, "createUser");
    assertTrue(action.hasFieldErrors());
    Map<String, Object> errors = action.getFieldErrors();
    assertEquals(1, errors.size());
  }
View Full Code Here

    assertEquals(1, errors.size());
  }
 
  @SuppressWarnings("unchecked")
  public void testValidationInvalidEmail() throws Exception{
    DefaultActionValidatorManager validator = new DefaultActionValidatorManager();
    action.setUsername("abc30");
    action.setPassword("popoop");
    action.setPasswordConfirm("popoop");
    action.setEmail("233@");
    validator.validate(action, "createUser");
    assertTrue(action.hasFieldErrors());
    Map<String, Object> errors = action.getFieldErrors();
    assertEquals(1, errors.size());
  }
View Full Code Here

    assertEquals(1, errors.size());
  }
 
  @SuppressWarnings("unchecked")
  public void testValidationPasswdDontMatch() throws Exception{
    DefaultActionValidatorManager validator = new DefaultActionValidatorManager();
    action.setUsername("abc30");
    action.setPassword("poploop1");
    action.setPasswordConfirm("poploop");
    action.setEmail("233@foo.com");
    validator.validate(action, "createUser");
    assertTrue(action.hasFieldErrors());
    Map<String, Object> errors = action.getFieldErrors();
    assertEquals(1, errors.size());
  }
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork.validator.DefaultActionValidatorManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.