Examples of validateValue()


Examples of javax.validation.Validator.validateValue()

  @Test(expectedExceptions = IllegalArgumentException.class)
  @SpecAssertion(section = "5.1.1", id = "i")
  public void testValidateValuePassingNullAsGroup() {
    Validator validator = TestUtil.getValidatorUnderTest();
    validator.validateValue( Customer.class, "firstName", "foobar", (Class<?>) null );
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  @SpecAssertion(section = "5.1.1", id = "i")
  public void testValidateValueWithEmptyPropertyPath() {
View Full Code Here

Examples of javax.validation.Validator.validateValue()

  @Test(expectedExceptions = IllegalArgumentException.class)
  @SpecAssertion(section = "5.1.1", id = "i")
  public void testValidateValueWithEmptyPropertyPath() {
    Validator validator = TestUtil.getValidatorUnderTest();
    validator.validateValue( Customer.class, "", null );
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  @SpecAssertion(section = "5.1.1", id = "i")
  public void testValidateValueWithNullObject() {
View Full Code Here

Examples of javax.validation.Validator.validateValue()

  @Test(expectedExceptions = IllegalArgumentException.class)
  @SpecAssertion(section = "5.1.1", id = "i")
  public void testValidateValueWithNullObject() {
    Validator validator = TestUtil.getValidatorUnderTest();
    validator.validateValue( null, "firstName", "foobar" );
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  @SpecAssertion(section = "5.1.1", id = "i")
  public void testValidateValueWithNullPropertyName() {
View Full Code Here

Examples of javax.validation.Validator.validateValue()

  @Test(expectedExceptions = IllegalArgumentException.class)
  @SpecAssertion(section = "5.1.1", id = "i")
  public void testValidateValueWithNullPropertyName() {
    Validator validator = TestUtil.getValidatorUnderTest();
    validator.validateValue( Customer.class, null, "foobar" );
  }

  @Test
  @SpecAssertion(section = "5.1.1", id = "j")
  public void testValidIsNotHonoredValidateValue() {
View Full Code Here

Examples of javax.validation.Validator.validateValue()

    Customer customer = new Customer();
    Order order = new Order();
    customer.addOrder( order );

    Set<ConstraintViolation<Customer>> constraintViolations = validator.validateValue(
        Customer.class, "orders", order
    );
    assertCorrectNumberOfViolations( constraintViolations, 0 );
  }
}
View Full Code Here

Examples of javax.validation.Validator.validateValue()

        BoundariesConstraintValidator.isValidCalls > nbrOfValidCalls,
        "Ensure is valid has been called."
    );
    nbrOfValidCalls = BoundariesConstraintValidator.isValidCalls;

    validator.validateValue( Shoe.class, "size", 41 );
    assertTrue(
        BoundariesConstraintValidator.isValidCalls > nbrOfValidCalls,
        "Ensure is valid has been called."
    );
  }
View Full Code Here

Examples of javax.validation.Validator.validateValue()

    Configuration<?> config = TestUtil.getConfigurationUnderTest().traversableResolver( resolver );

    ValidatorFactory factory = config.buildValidatorFactory();
    Validator v = factory.getValidator();

    v.validateValue( Suit.class, "size", 3333 );

    assertEquals( resolver.getReachableCallCount(), 1 );
    assertEquals( resolver.getCascadableCallCount(), 0 );
  }
View Full Code Here

Examples of javax.validation.Validator.validateValue()

    assertCorrectNumberOfViolations( constraintViolations, 1 );
    assertCorrectConstraintViolationMessages(
        constraintViolations, "Car type has to be between 2 and 20 characters."
    );

    constraintViolations = validator.validateValue( Car.class, "type", "A" );
    assertCorrectNumberOfViolations( constraintViolations, 1 );
    assertCorrectConstraintViolationMessages(
        constraintViolations, "Car type has to be between 2 and 20 characters."
    );
  }
View Full Code Here

Examples of javax.validation.Validator.validateValue()

        final String propertyName = path[path.length - 1];
        PropertyDescriptor propertyDescriptor = beanDescriptor.getConstraintsForProperty(propertyName);

        if (propertyDescriptor == null) return;

        final Set<ConstraintViolation<Object>> violations = validator.validateValue(
                (Class<Object>) beanType, propertyName,
                value, beanValidationGroupSource.get());

        if (violations.isEmpty())
        {
View Full Code Here

Examples of javax.validation.Validator.validateValue()

    Property property = getProperty();

    // validate the value using the bean validator

    Set<?> violations = validator.validateValue(property.getOwner(), property.getName(),
      validatable.getValue(), getGroups());

    // iterate over violations and report them

    for (ConstraintViolation<?> violation : (Set<ConstraintViolation<?>>)violations)
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.