Package org.springframework.validation.beanvalidation

Examples of org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet()


    }

    private Validator getValidator() {
        if (this.validator == null) {
            LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
            localValidatorFactoryBean.afterPropertiesSet();
            this.validator = localValidatorFactoryBean;
        }
        return this.validator;
    }
View Full Code Here


*/
public class ValidatorTests {
 
  private Validator createValidator() {
        LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
        localValidatorFactoryBean.afterPropertiesSet();
        return localValidatorFactoryBean;
    }

  @Test
    public void emptyFirstName() {
View Full Code Here

        assertTrue(createUserRequest.getAddress().getStreets().size() > 0);
    }

    private Validator getValidator() {
        LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
        localValidatorFactoryBean.afterPropertiesSet();
        return localValidatorFactoryBean;
    }
}
View Full Code Here

    }

    private Validator getValidator() {
        if (this.validator == null) {
            LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
            localValidatorFactoryBean.afterPropertiesSet();
            this.validator = localValidatorFactoryBean;
        }
        return this.validator;
    }
View Full Code Here

  private final class ValidatingBinderFactory implements WebDataBinderFactory {

    @Override
    public WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName) throws Exception {
      LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
      validator.afterPropertiesSet();
      WebDataBinder dataBinder = new WebDataBinder(target, objectName);
      dataBinder.setValidator(validator);
      return dataBinder;
    }
  }
View Full Code Here

  private final class ValidatingBinderFactory implements WebDataBinderFactory {

    @Override
    public WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName) {
      LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
      validator.afterPropertiesSet();
      WebDataBinder dataBinder = new WebDataBinder(target, objectName);
      dataBinder.setValidator(validator);
      return dataBinder;
    }
  }
View Full Code Here

public class ValidatorFactoryTests {

  @Test
  public void testSimpleValidation() throws Exception {
    LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
    validator.afterPropertiesSet();
    ValidPerson person = new ValidPerson();
    Set<ConstraintViolation<ValidPerson>> result = validator.validate(person);
    assertEquals(2, result.size());
    for (ConstraintViolation<ValidPerson> cv : result) {
      String path = cv.getPropertyPath().toString();
View Full Code Here

  @Test
  public void testSimpleValidationWithCustomProvider() throws Exception {
    LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
    validator.setProviderClass(HibernateValidator.class);
    validator.afterPropertiesSet();
    ValidPerson person = new ValidPerson();
    Set<ConstraintViolation<ValidPerson>> result = validator.validate(person);
    assertEquals(2, result.size());
    for (ConstraintViolation<ValidPerson> cv : result) {
      String path = cv.getPropertyPath().toString();
View Full Code Here

  }

  @Test
  public void testSimpleValidationWithClassLevel() throws Exception {
    LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
    validator.afterPropertiesSet();
    ValidPerson person = new ValidPerson();
    person.setName("Juergen");
    person.getAddress().setStreet("Juergen's Street");
    Set<ConstraintViolation<ValidPerson>> result = validator.validate(person);
    assertEquals(1, result.size());
View Full Code Here

  }

  @Test
  public void testSpringValidationFieldType() throws Exception {
    LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
    validator.afterPropertiesSet();
    ValidPerson person = new ValidPerson();
    person.setName("Phil");
    person.getAddress().setStreet("Phil's Street");
    BeanPropertyBindingResult errors = new BeanPropertyBindingResult(person, "person");
    validator.validate(person, errors);
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.