Package javax.validation.executable

Examples of javax.validation.executable.ExecutableValidator.validateParameters()


        .usingContext()
        .parameterNameProvider( new DummyParameterNameProvider() )
        .getValidator();
    ExecutableValidator executableValidator = validator.forExecutables();
    Method addOrderMethod = Customer.class.getMethod( "addOrder", Order.class );
    Set<ConstraintViolation<Customer>> constraintViolations = executableValidator.validateParameters(
        new Customer(),
        addOrderMethod,
        new Object[] { null }
    );
    assertNumberOfViolations( constraintViolations, 1 );
View Full Code Here


  @Test
  public void testOptionalUnwrappedExecutableParameter() throws Exception {
    ExecutableValidator executableValidator = validator.forExecutables();
    Method method = Baz.class.getMethod( "setOptionalLong", Optional.class );
    Object[] values = { Optional.of( 2L ) };
    Set<ConstraintViolation<Baz>> constraintViolations = executableValidator.validateParameters(
        new Baz(),
        method,
        values
    );
    assertNumberOfViolations( constraintViolations, 1 );
View Full Code Here

  @Test
  public void testOptionalUnwrappedCascadableExecutableParameter() throws Exception {
    ExecutableValidator executableValidator = validator.forExecutables();
    Method method = Fubar.class.getMethod( "setBar", Optional.class );
    Object[] values = { Optional.of( new Bar() ) };
    Set<ConstraintViolation<Fubar>> constraintViolations = executableValidator.validateParameters(
        new Fubar(),
        method,
        values
    );
    assertNumberOfViolations( constraintViolations, 1 );
View Full Code Here

        .parameterNameProvider( new MyParameterNameProvider() )
        .buildValidatorFactory()
        .getValidator()
        .forExecutables();

    Set<ConstraintViolation<User>> constraintViolations = executableValidator.validateParameters(
        new User(),
        User.class.getMethod( "setAddresses", Map.class ),
        new java.lang.Object[] { new HashMap() }
    );
View Full Code Here

    Object object = new ComputerGame( "Giovanni Brothers" );
    Method method = ComputerGame.class.getMethod( "pauseGame", int.class );
    Object[] parameterValues = new Object[] { -2 };

    Set<ConstraintViolation<Object>> violations = executableValidator.validateParameters(
        object,
        method,
        parameterValues
    );
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.