Package org.springframework.validation

Examples of org.springframework.validation.ObjectError


    final String username = "canonical"; //specified username already exists in database
    final String password = "password";
    final String confirmPassword = password;
    final User existingUser = new User();
    List<ObjectError> errorList = new ArrayList<ObjectError>();
    final ObjectError error = new ObjectError("username.exists", "Username already exists");
   
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
View Full Code Here


    final BindingResult errors = createNiceMock(BindingResult.class);
    final String username = "u"; //username length less than 2 characters
    final String password = "password";
    final String confirmPassword = password;
    List<ObjectError> errorList = new ArrayList<ObjectError>();
    final ObjectError error = new ObjectError("username.invalid.length", "Username must be atleast 2 characters long");
   
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
View Full Code Here

       
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
    errorList.add(new ObjectError("password.required", "Password required"));
    errorList.add(new ObjectError("confirmPassword.required", "Confirm password required"));
   
    expect(errors.hasErrors()).andReturn(true).anyTimes();   
    expect(errors.getAllErrors()).andReturn(errorList).anyTimes();
    replay(errors);
   
View Full Code Here

       
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
    errorList.add(new ObjectError("confirmPassword.required", "Confirm password required"));
   
    expect(errors.hasErrors()).andReturn(true).anyTimes();   
    expect(errors.getAllErrors()).andReturn(errorList).anyTimes();
    replay(errors);
   
View Full Code Here

       
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
    errorList.add(new ObjectError("password.invalid.length", "Password must be atleast 4 characters long"));
   
    expect(errors.hasErrors()).andReturn(true).anyTimes();   
    expect(errors.getAllErrors()).andReturn(errorList).anyTimes();
    replay(errors);
   
View Full Code Here

       
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
    errorList.add(new ObjectError("confirmPassword.mismatch", "Password mismatch"));
   
    expect(errors.hasErrors()).andReturn(true).anyTimes();   
    expect(errors.getAllErrors()).andReturn(errorList).anyTimes();
    replay(errors);
   
View Full Code Here

       
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
    errorList.add(new ObjectError("confirmPassword.mismatch", "Password mismatch"));
   
    expect(errors.hasErrors()).andReturn(true).anyTimes();   
    expect(errors.getAllErrors()).andReturn(errorList).anyTimes();
    replay(errors);
   
View Full Code Here

       
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
    errorList.add(new ObjectError("username.required", "Username required"));
    errorList.add(new ObjectError("password.required", "Password required"));
    errorList.add(new ObjectError("confirmPassword.required", "Confirm password required"));
   
    expect(errors.hasErrors()).andReturn(true).anyTimes();   
    expect(errors.getAllErrors()).andReturn(errorList).anyTimes();
    replay(errors);
   
View Full Code Here

   * Extract the error codes from the ObjectError list.
   */
  private void initErrorCodes() {
    this.errorCodes = new String[this.objectErrors.size()];
    for (int i = 0; i < this.objectErrors.size(); i++) {
      ObjectError error = (ObjectError) this.objectErrors.get(i);
      this.errorCodes[i] = error.getCode();
    }
  }
View Full Code Here

   */
  private void initErrorMessages() throws NoSuchMessageException {
    if (this.errorMessages == null) {
      this.errorMessages = new String[this.objectErrors.size()];
      for (int i = 0; i < this.objectErrors.size(); i++) {
        ObjectError error = (ObjectError) this.objectErrors.get(i);
        this.errorMessages[i] = this.requestContext.getMessage(error, this.htmlEscape);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.validation.ObjectError

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.