Examples of validateReturnValue()


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

    ExecutableValidator methodValidator = validator.forExecutables();
    Method method = CardValidator04.class.getMethod("validate", CreditCard04.class);
    Set<ConstraintViolation<CardValidator04>> violations = methodValidator.validateParameters(cardValidator, method, new Object[]{creditCard});
    assertEquals(0, violations.size());

    violations = methodValidator.validateReturnValue(cardValidator, method, Boolean.TRUE);
    assertEquals(0, violations.size());
  }

  @Test
  public void shouldRaiseConstraintViolationCauseCreditCardIsNull() throws NoSuchMethodException {
View Full Code Here

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

    CD10 cd = new CD10("title", 12.80f, "Beatles master piece", "Apple", 1, 53.32f, "Pop");

    ExecutableValidator methodValidator = validator.forExecutables();
    Method method = CD10.class.getMethod("calculateVAT");
    Set<ConstraintViolation<CD10>> violations = methodValidator.validateReturnValue(cd, method, new Float(10.0));
    assertEquals(0, violations.size());
  }

  @Test
  public void shouldRaiseAnExceptionCauseOverriddenMethodCannotHaveConstraintParameters() throws NoSuchMethodException {
View Full Code Here

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

    Item10 item = new Item10("H2G2", 12.5f, "Best IT Scifi Book");

    ExecutableValidator methodValidator = validator.forExecutables();
    Method method = Item10.class.getMethod("calculateVAT");
    Set<ConstraintViolation<Item10>> violations = methodValidator.validateReturnValue(item, method, new Float(10.0));
    assertEquals(0, violations.size());
  }

  @Test
  public void shouldRaiseNoConstraintViolationOnCalculatePrice() throws NoSuchMethodException {
View Full Code Here

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

    Gentleman gentleman = new Gentleman();
    gentleman.wearSuit( suit );
    Method method = Gentleman.class.getMethod( "undress" );

    executableValidator.validateReturnValue(
        gentleman,
        method,
        suit
    );
View Full Code Here

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

        }               
    }
   
    public< T > void validateReturnValue(final T instance, final Method method, final Object returnValue) {
        final ExecutableValidator methodValidator = getExecutableValidator();
        final Set<ConstraintViolation< T > > violations = methodValidator.validateReturnValue(instance,
            method, returnValue);
       
        if (!violations.isEmpty()) {
            throw new ResponseConstraintViolationException(violations);
        }               
View Full Code Here

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

      );
    }

    Object result = ctx.proceed();

    violations = executableValidator.validateReturnValue(
        ctx.getTarget(),
        ctx.getMethod(),
        result
    );
View Full Code Here

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

      );
    }

    Object result = ctx.proceed();

    violations = executableValidator.validateReturnValue(
        ctx.getTarget(),
        ctx.getMethod(),
        result
    );
View Full Code Here

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

  @Test
  public void testOptionalUnwrappedExecutableReturnValue() throws Exception {
    ExecutableValidator executableValidator = validator.forExecutables();
    Method method = Foo.class.getMethod( "getOptionalLong" );
    Set<ConstraintViolation<Foo>> constraintViolations = executableValidator.validateReturnValue(
        new Foo(),
        method,
        Optional.of( 9L )
    );
    assertNumberOfViolations( constraintViolations, 1 );
View Full Code Here

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

  @Test
  public void testOptionalUnwrappedCascadableExecutableReturnValue() throws Exception {
    ExecutableValidator executableValidator = validator.forExecutables();
    Method method = Qux.class.getMethod( "getBar" );
    Set<ConstraintViolation<Qux>> constraintViolations = executableValidator.validateReturnValue(
        new Qux(),
        method,
        Optional.of( new Bar() )
    );
    assertNumberOfViolations( constraintViolations, 1 );
View Full Code Here

Examples of org.apache.cxf.validation.BeanValidationProvider.validateReturnValue()

            MessageContentsList list = (MessageContentsList)response;
            if (list.size() == 1) {
                Object entity = ((MessageContentsList)list).get(0);
               
                if (entity instanceof Response) {
                    theProvider.validateReturnValue(serviceObject, m, ((Response)entity).getEntity());   
                } else {               
                    theProvider.validateReturnValue(serviceObject, m, entity);
                }
            }
        }
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.