Examples of validateProperty()


Examples of javax.validation.Validator.validateProperty()

        car, "licensePlateNumber", First.class, org.apache.bval.jsr303.example.Second.class
    );
    assertCorrectNumberOfViolations(violations, 1);

    car.setLicensePlateNumber("USD-298");
    violations = validator.validateProperty(
        car, "licensePlateNumber", First.class, org.apache.bval.jsr303.example.Second.class
    );
    assertCorrectNumberOfViolations(violations, 0);
  }
View Full Code Here

Examples of javax.validation.Validator.validateProperty()

      @SpecAssertion(section = "5.1.3", id = "b")
  })
  public void testCorrectGroupsAreAppliedForValidateProperty() {
    Validator validator = TestUtil.getValidatorUnderTest();

    Set<ConstraintViolation<Address>> constraintViolations = validator.validateProperty( new Address(), "city" );
    assertCorrectNumberOfViolations( constraintViolations, 1 );
    assertCorrectConstraintTypes( constraintViolations, NotNull.class );
    assertCorrectPropertyPaths( constraintViolations, "city" );

    constraintViolations = validator.validateProperty( new Address(), "city", Default.class );
View Full Code Here

Examples of javax.validation.Validator.validateProperty()

    Set<ConstraintViolation<Address>> constraintViolations = validator.validateProperty( new Address(), "city" );
    assertCorrectNumberOfViolations( constraintViolations, 1 );
    assertCorrectConstraintTypes( constraintViolations, NotNull.class );
    assertCorrectPropertyPaths( constraintViolations, "city" );

    constraintViolations = validator.validateProperty( new Address(), "city", Default.class );
    assertCorrectNumberOfViolations( constraintViolations, 1 );
    assertCorrectConstraintTypes( constraintViolations, NotNull.class );
    assertCorrectPropertyPaths( constraintViolations, "city" );

    constraintViolations = validator.validateProperty( new Address(), "city", Address.Minimal.class );
View Full Code Here

Examples of javax.validation.Validator.validateProperty()

    constraintViolations = validator.validateProperty( new Address(), "city", Default.class );
    assertCorrectNumberOfViolations( constraintViolations, 1 );
    assertCorrectConstraintTypes( constraintViolations, NotNull.class );
    assertCorrectPropertyPaths( constraintViolations, "city" );

    constraintViolations = validator.validateProperty( new Address(), "city", Address.Minimal.class );
    assertCorrectNumberOfViolations( constraintViolations, 0 );

    constraintViolations = validator.validateProperty( new Address(), "street", Address.Minimal.class );
    assertCorrectNumberOfViolations( constraintViolations, 1 );
    assertCorrectConstraintTypes( constraintViolations, NotEmpty.class );
View Full Code Here

Examples of javax.validation.Validator.validateProperty()

    assertCorrectPropertyPaths( constraintViolations, "city" );

    constraintViolations = validator.validateProperty( new Address(), "city", Address.Minimal.class );
    assertCorrectNumberOfViolations( constraintViolations, 0 );

    constraintViolations = validator.validateProperty( new Address(), "street", Address.Minimal.class );
    assertCorrectNumberOfViolations( constraintViolations, 1 );
    assertCorrectConstraintTypes( constraintViolations, NotEmpty.class );
    assertCorrectPropertyPaths( constraintViolations, "street" );
  }
View Full Code Here

Examples of javax.validation.Validator.validateProperty()

  @Test
  @SpecAssertion(section = "5.3.1", id = "d")
  public void testMessagesCanBeOverriddenAtConstraintLevel() {
    Validator validator = TestUtil.getValidatorUnderTest();
    Set<ConstraintViolation<DummyEntity>> constraintViolations = validator.validateProperty(
        new DummyEntity(), "snafu"
    );
    assertCorrectNumberOfViolations( constraintViolations, 1 );
    assertCorrectConstraintViolationMessages(
        constraintViolations, "messages can also be overridden at constraint declaration."
View Full Code Here

Examples of javax.validation.Validator.validateProperty()

  @SpecAssertion(section = "4.4.2", id = "b")
  public void testOnlyFirstGroupInSequenceGetEvaluated() {
    Validator validator = TestUtil.getValidatorUnderTest();
    Car car = new Car( "USd-298" );

    Set<ConstraintViolation<Car>> violations = validator.validateProperty(
        car, "licensePlateNumber", First.class, Second.class
    );
    assertCorrectNumberOfViolations( violations, 1 );

    car.setLicensePlateNumber( "USD-298" );
View Full Code Here

Examples of javax.validation.Validator.validateProperty()

        car, "licensePlateNumber", First.class, Second.class
    );
    assertCorrectNumberOfViolations( violations, 1 );

    car.setLicensePlateNumber( "USD-298" );
    violations = validator.validateProperty(
        car, "licensePlateNumber", First.class, Second.class
    );
    assertCorrectNumberOfViolations( violations, 0 );
  }
View Full Code Here

Examples of javax.validation.Validator.validateProperty()

  })
  public void testFieldAccess() {
    SuperWoman superwoman = new SuperWoman();

    Validator validator = TestUtil.getValidatorUnderTest();
    Set<ConstraintViolation<SuperWoman>> violations = validator.validateProperty( superwoman, "firstName" );
    assertCorrectNumberOfViolations( violations, 0 );

    superwoman.setFirstName( null );
    violations = validator.validateProperty( superwoman, "firstName" );
    assertCorrectNumberOfViolations( violations, 1 );
View Full Code Here

Examples of javax.validation.Validator.validateProperty()

    Validator validator = TestUtil.getValidatorUnderTest();
    Set<ConstraintViolation<SuperWoman>> violations = validator.validateProperty( superwoman, "firstName" );
    assertCorrectNumberOfViolations( violations, 0 );

    superwoman.setFirstName( null );
    violations = validator.validateProperty( superwoman, "firstName" );
    assertCorrectNumberOfViolations( violations, 1 );
    assertCorrectConstraintTypes( violations, NotNull.class );
  }

  @Test
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.