Package org.hibernate.validator

Examples of org.hibernate.validator.HibernateValidatorConfiguration.addProperty()


  @Test
  @TestForIssue(jiraKey = "HV-381")
  public void testFailFastSetWithProperty() {
    // with fail fast
    HibernateValidatorConfiguration configuration = ValidatorUtil.getConfiguration( HibernateValidator.class );
    ValidatorFactory factory = configuration.addProperty( HibernateValidatorConfiguration.FAIL_FAST, "true" )
        .buildValidatorFactory();

    Validator validator = factory.getValidator();

    Set<ConstraintViolation<A>> constraintViolations = validator.validate( testInstance );
View Full Code Here


    Set<ConstraintViolation<A>> constraintViolations = validator.validate( testInstance );
    assertNumberOfViolations( constraintViolations, 1 );

    // without fail fast
    configuration = ValidatorUtil.getConfiguration( HibernateValidator.class );
    factory = configuration.addProperty( HibernateValidatorConfiguration.FAIL_FAST, "false" )
        .buildValidatorFactory();

    validator = factory.getValidator();
    constraintViolations = validator.validate( testInstance );
    assertNumberOfViolations( constraintViolations, 2 );
View Full Code Here

  @Test
  @TestForIssue(jiraKey = "HV-381")
  public void testFailFastMethodValidationSetWithProperty() {
    final HibernateValidatorConfiguration configuration = ValidatorUtil.getConfiguration( HibernateValidator.class );
    final ValidatorFactory factory = configuration.addProperty( HibernateValidatorConfiguration.FAIL_FAST, "true" )
        .buildValidatorFactory();

    final Validator validator = factory.getValidator();

    TestService service = getValidatingProxy( new TestServiceImpl(), validator );
View Full Code Here

  @TestForIssue(jiraKey = "HV-381")
  public void testFailFastSetWithInvalidProperty() {
    final HibernateValidatorConfiguration configuration = ValidatorUtil.getConfiguration( HibernateValidator.class );

    //Default fail fast property value is false
    final ValidatorFactory factory = configuration.addProperty(
        HibernateValidatorConfiguration.FAIL_FAST, "not correct"
    ).buildValidatorFactory();

    final Validator validator = factory.getValidator();
    Set<ConstraintViolation<A>> constraintViolations = validator.validate( testInstance );
View Full Code Here

  @TestForIssue(jiraKey = "HV-381")
  public void testFailFastSetWithInconsistentConfiguration() {
    final HibernateValidatorConfiguration configuration = ValidatorUtil.getConfiguration( HibernateValidator.class );

    //Default fail fast property value is false
    final ValidatorFactory factory = configuration.addProperty(
        HibernateValidatorConfiguration.FAIL_FAST, "false"
    ).failFast( true ).buildValidatorFactory();

    factory.getValidator();
  }
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.