Package org.springframework.validation

Examples of org.springframework.validation.BeanPropertyBindingResult.reject()


   * http://opensource.atlassian.com/projects/spring/browse/SPR-4005
   */
  public void testOmittedPathMatchesObjectErrorsOnly() throws Exception {
    this.tag.setPath(null);
    Errors errors = new BeanPropertyBindingResult(new TestBean(), "COMMAND_NAME");
    errors.reject("some.code", "object error");
    errors.rejectValue("name", "some.code", "field error");
    exposeBindingResult(errors);
    this.tag.doStartTag();
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
    this.tag.doEndTag();
View Full Code Here


            Group group = groupService.createGroup(groupForm);

            // Check if group was actually created or not
            if (group == null || group.getId() == null || group.getId() <= 0) {
                // Add generic error
                errors.reject("groupValidator.generic");
                result.setResult(false);
            } else {
                // Group created successfully so add groupModel to result
                result.setResult(true);
                result.setValue(groupService.createGroupModel(group));
View Full Code Here

   * http://opensource.atlassian.com/projects/spring/browse/SPR-4005
   */
  public void testOmittedPathMatchesObjectErrorsOnly() throws Exception {
    this.tag.setPath(null);
    Errors errors = new BeanPropertyBindingResult(new TestBean(), "COMMAND_NAME");
    errors.reject("some.code", "object error");
    errors.rejectValue("name", "some.code", "field error");
    exposeBindingResult(errors);
    this.tag.doStartTag();
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
    this.tag.doEndTag();
View Full Code Here

  }

  public void testSpecificPathMatchesSpecificFieldOnly() throws Exception {
    this.tag.setPath("name");
    Errors errors = new BeanPropertyBindingResult(new TestBean(), "COMMAND_NAME");
    errors.reject("some.code", "object error");
    errors.rejectValue("name", "some.code", "field error");
    exposeBindingResult(errors);
    this.tag.doStartTag();
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
    this.tag.doEndTag();
View Full Code Here

  }

  public void testStarMatchesAllErrors() throws Exception {
    this.tag.setPath("*");
    Errors errors = new BeanPropertyBindingResult(new TestBean(), "COMMAND_NAME");
    errors.reject("some.code", "object error");
    errors.rejectValue("name", "some.code", "field error");
    exposeBindingResult(errors);
    this.tag.doStartTag();
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
    this.tag.doEndTag();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.