Examples of forExecutables()


Examples of javax.validation.Validator.forExecutables()

    try {
      Object object = new User();
      Method method = User.class.getMethod( "setNames", String.class, String.class );
      Object[] parameters = new Object[] { null, null };

      validator.forExecutables().validateParameters( object, method, parameters );
      fail( "Expected exception wasn't thrown" );
    }
    catch ( ValidationException e ) {
      throw e.getCause();
    }
View Full Code Here

Examples of javax.validation.Validator.forExecutables()

      }

      Set<ResteasyConstraintViolation> rcvs = new HashSet<ResteasyConstraintViolation>();
      try
      {
         Set<ConstraintViolation<Object>> cvs = validator.forExecutables().validateParameters(object, method, parameterValues, groups);
         for (Iterator<ConstraintViolation<Object>> it = cvs.iterator(); it.hasNext(); )
         {
            ConstraintViolation<Object> cv = it.next();
            Type ct = util.getConstraintType(cv);
            String path = (suppressPath ? "*" : cv.getPropertyPath().toString());
View Full Code Here

Examples of javax.validation.Validator.forExecutables()

      Validator validator = getValidator(request);
      Set<ResteasyConstraintViolation> rcvs = new HashSet<ResteasyConstraintViolation>();
      ViolationsContainer<Object> violationsContainer = getViolationsContainer(request, object);
      try
      {
         Set<ConstraintViolation<Object>> cvs = validator.forExecutables().validateReturnValue(object, method, returnValue, groups);
         for (Iterator<ConstraintViolation<Object>> it = cvs.iterator(); it.hasNext(); )
         {
            ConstraintViolation<Object> cv = it.next();
            Type ct = util.getConstraintType(cv);
            Object o = cv.getInvalidValue();
View Full Code Here

Examples of javax.validation.Validator.forExecutables()

    ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
    Validator validator = factory
        .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 }
View Full Code Here

Examples of javax.validation.Validator.forExecutables()

    B b = new B();
    b.c = new C();
    Method method = GetMethod.action( B.class, "getC" ).run();

    Set<ConstraintViolation<B>> violations = validator.forExecutables().validateReturnValue(
        b, method, b.getC()
    );

    assertNumberOfViolations( violations, 1 );
    assertCorrectConstraintViolationMessages( violations, "may not be null" );
View Full Code Here

Examples of javax.validation.Validator.forExecutables()

    OrderLine orderLine = new OrderLine();
    Method method = OrderLine.class.getMethod( "setId", Property.class );
    Object[] parameterValues = new Object[] { new Property<Long>( 0L ) };

    Set<ConstraintViolation<OrderLine>> violations = validator.forExecutables()
        .validateParameters( orderLine, method, parameterValues );

    assertEquals( violations.size(), 1 );
  }
View Full Code Here

Examples of javax.validation.Validator.forExecutables()

    OrderLine orderLine = new OrderLine();
    Method method = OrderLine.class.getMethod( "getId" );
    Object returnValue = new Property<Long>( 0L );

    Set<ConstraintViolation<OrderLine>> violations = validator.forExecutables()
        .validateReturnValue( orderLine, method, returnValue );

    assertEquals( violations.size(), 1 );
  }
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.