Package org.hibernate.validator.internal.engine

Examples of org.hibernate.validator.internal.engine.ValueContext


  }

  @Test
  public void testGetInitializedValidator() {
    ConstraintDescriptorImpl<?> constraintDescriptor = getConstraintDescriptorForProperty( "s1" );
    ValueContext valueContext = ValueContext.getLocalExecutionContext( new Foo(), null, null );
    valueContext.setDeclaredTypeOfValidatedElement( String.class );

    ConstraintValidator<?, ?> constraintValidator = constraintValidatorManager.getInitializedValidator(
        valueContext,
        constraintDescriptor,
        constraintValidatorFactory
View Full Code Here


  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNullValidatedValueThrowsIllegalArgumentException() {
    ConstraintDescriptorImpl<?> constraintDescriptor = getConstraintDescriptorForProperty( "s1" );
    ValueContext valueContext = ValueContext.getLocalExecutionContext( new Foo(), null, null );
    valueContext.setDeclaredTypeOfValidatedElement( null );

    constraintValidatorManager.getInitializedValidator(
        valueContext,
        constraintDescriptor,
        constraintValidatorFactory
View Full Code Here

    );
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNullDescriptorThrowsIllegalArgumentException() {
    ValueContext valueContext = ValueContext.getLocalExecutionContext( new Foo(), null, null );
    valueContext.setDeclaredTypeOfValidatedElement( String.class );

    constraintValidatorManager.getInitializedValidator(
        valueContext,
        null,
        constraintValidatorFactory
View Full Code Here

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNullFactoryThrowsIllegalArgumentException() {
    ConstraintDescriptorImpl<?> constraintDescriptor = getConstraintDescriptorForProperty( "s1" );
    ValueContext valueContext = ValueContext.getLocalExecutionContext( new Foo(), null, null );
    valueContext.setDeclaredTypeOfValidatedElement( String.class );

    constraintValidatorManager.getInitializedValidator(
        valueContext,
        constraintDescriptor,
        null
View Full Code Here

  @Test(expectedExceptions = UnexpectedTypeException.class,
      expectedExceptionsMessageRegExp = "HV000030.*")
  public void testUnexpectedTypeException() {
    ConstraintDescriptorImpl<?> constraintDescriptor = getConstraintDescriptorForProperty( "s2" );

    ValueContext valueContext = ValueContext.getLocalExecutionContext(
        new Foo(), null, PathImpl.createPathFromString( "s2" )
    );
    valueContext.setDeclaredTypeOfValidatedElement( Object.class );

    constraintValidatorManager.getInitializedValidator(
        valueContext,
        constraintDescriptor,
        constraintValidatorFactory
View Full Code Here

  }

  @Test
  public void testConstraintValidatorInstancesAreCachedPerFactory() {
    ConstraintDescriptorImpl<?> constraintDescriptor = getConstraintDescriptorForProperty( "s1" );
    ValueContext valueContext = ValueContext.getLocalExecutionContext( new Foo(), null, null );
    valueContext.setDeclaredTypeOfValidatedElement( String.class );

    ConstraintValidator<?, ?> constraintValidator1 = constraintValidatorManager.getInitializedValidator(
        valueContext,
        constraintDescriptor,
        constraintValidatorFactory
View Full Code Here

  }

  @Test
  public void testOnlyTheInstancesForTheLeastRecentlyUsedCustomFactoryAreCached() {
    ConstraintDescriptorImpl<?> constraintDescriptor = getConstraintDescriptorForProperty( "s1" );
    ValueContext valueContext = ValueContext.getLocalExecutionContext( new Foo(), null, null );
    valueContext.setDeclaredTypeOfValidatedElement( String.class );

    for ( int i = 0; i < 10; i++ ) {
      constraintValidatorManager.getInitializedValidator(
          valueContext,
          constraintDescriptor,
View Full Code Here

            )
        )
        .buildValidatorFactory()
        .getValidator();

    ValueContext valueContext = ValueContext.getLocalExecutionContext( new User(), null, null );
    valueContext.setDeclaredTypeOfValidatedElement( String.class );

    ConstraintDescriptorImpl<?> notNullOnFirstNameDescriptor = getSingleConstraintDescriptorForProperty(
        validator, User.class, "firstName"
    );
    ConstraintDescriptorImpl<?> notNullOnLastNameDescriptor = getSingleConstraintDescriptorForProperty(
View Full Code Here

            )
        )
        .buildValidatorFactory()
        .getValidator();

    ValueContext valueContext = ValueContext.getLocalExecutionContext( new User(), null, null );
    valueContext.setDeclaredTypeOfValidatedElement( String.class );

    ConstraintDescriptorImpl<?> sizeOnMiddleNameDescriptor = getSingleConstraintDescriptorForProperty(
        validator, User.class, "middleName"
    );
    ConstraintDescriptorImpl<?> sizeOnAddress1Descriptor = getSingleConstraintDescriptorForProperty(
View Full Code Here

TOP

Related Classes of org.hibernate.validator.internal.engine.ValueContext

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.