Package org.springframework.validation

Examples of org.springframework.validation.MapBindingResult


        person.setAge(21);
        person.setCreditStatus(CreditStatus.PENDING);
        person.setCreditRating(CreditRating.EXCELLENT);
        person.setLastUpdated(new Date());
       
        Errors errors = new MapBindingResult(new HashMap(), "person");

        validator.validate(person, errors);
       
        assertTrue("Should have an error.", errors.hasErrors());
    }
View Full Code Here


        person.setAge(21);
        person.setCreditStatus(CreditStatus.PENDING);
        person.setCreditRating(CreditRating.BAD);
        person.setLastUpdated(new Date());
       
        Errors errors = new MapBindingResult(new HashMap(), "person");

        validator.validate(person, errors);
       
        assertTrue("Should have an error.", errors.hasErrors());
    }
View Full Code Here

    person.setAge(21);
    person.setCreditStatus(CreditStatus.PENDING);
    person.setCreditRating(CreditRating.EXCELLENT);
    person.setLastUpdated(new Date());
   
    Errors errors = new MapBindingResult(new HashMap(), "person");

    validator.validate(person, errors);
   
    assertTrue("Should not have any errors.", !errors.hasErrors());
  }
View Full Code Here

        person.setAge(21);
        person.setCreditStatus(CreditStatus.PENDING);
        person.setCreditRating(CreditRating.EXCELLENT);
        person.setLastUpdated(new Date());
       
        Errors errors = new MapBindingResult(new HashMap(), "person");

        validator.validate(person, errors);
       
        assertTrue("Should not have any errors.", !errors.hasErrors());
    }
View Full Code Here

        person.setAge(21);
        person.setCreditStatus(CreditStatus.FAIL);
        person.setCreditRating(CreditRating.EXCELLENT);
        person.setLastUpdated(new Date());
       
        Errors errors = new MapBindingResult(new HashMap(), "person");

        validator.validate(person, errors);
       
        assertTrue("Should have an error.", errors.hasErrors());
    }
View Full Code Here

        person.setAge(21);
        person.setCreditStatus(CreditStatus.PENDING);
        person.setCreditRating(CreditRating.FAIR);
        person.setLastUpdated(new Date());
       
        Errors errors = new MapBindingResult(new HashMap(), "person");

        validator.validate(person, errors);
       
        assertTrue("Should have an error.", errors.hasErrors());
    }
View Full Code Here

    BeanWrapper bean = new BeanWrapper();
    bean.setMapVars(hVars);
    bean.setListVars(lVars);
    bean.setVars(lVars.toArray());
   
    Errors errors = new MapBindingResult(new HashMap(), "person");

    validator.validate(bean, errors);
   
    assertTrue("Should not have any errors.", !errors.hasErrors());
  }
View Full Code Here

        address.setAddress("1060 West Addison");
        address.setCity("Chicago");
       
        bean.getAddresses().add(address);

        Errors errors = new MapBindingResult(new HashMap(), "person");
       
        personValidator.validate(bean, errors);
        assertTrue("Person validator should not have any errors.", !errors.hasErrors());
       
        errors = new MapBindingResult(new HashMap(), "person");
       
        bytecodePersonValidator.validate(bean, errors);
        assertTrue("Bytecode person validator hould not have any errors.", !errors.hasErrors());
    }
View Full Code Here

   * it reuses the errors object.
   */
  private double validate(Validator validator, Object bean) {
        double result = -1;
       
        Errors errors = new MapBindingResult(new HashMap(), "person");

        // warmup
        for (int i = 0; i < count; i++) {
            validator.validate(bean, errors);
        }

        long start = System.nanoTime();
       
        for (int i = 0; i < count; i++) {
            validator.validate(bean, errors);
        }

        long end = System.nanoTime();
       
        result = ((end - start)/count);
       
        logger.info("Took {}ns.", result);
       
        assertTrue("Should not have any errors.", !errors.hasErrors());
       
        return result;
  }
View Full Code Here

        Person person = new Person();
        person.setFirstName("John");
        person.setLastName("Johnson");

        Map<?, ?> errors = new HashMap();
        MapBindingResult bindingResult = new MapBindingResult(errors, "person");

        validator.validate(person, bindingResult);


        assertTrue("Validator has errors", !bindingResult.hasErrors());
    }
View Full Code Here

TOP

Related Classes of org.springframework.validation.MapBindingResult

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.