Examples of ExecutableValidator


Examples of javax.validation.executable.ExecutableValidator

    config.addMapping( mapping );

    Constructor<GreetingService> constructor = GreetingService.class.getConstructor( String.class, String.class );
    Object[] parameterValues = new Object[] { "", "" };

    ExecutableValidator executableValidator = getConfiguredExecutableValidator();

    Set<ConstraintViolation<GreetingService>> violations = executableValidator.validateConstructorParameters(
        constructor,
        parameterValues
    );

    assertCorrectConstraintViolationMessages(
View Full Code Here

Examples of javax.validation.executable.ExecutableValidator

    config.addMapping( mapping );

    Constructor<GreetingService> constructor = GreetingService.class.getConstructor( CharSequence.class );
    Object[] parameterValues = new Object[] { "" };

    ExecutableValidator executableValidator = getConfiguredExecutableValidator();

    Set<ConstraintViolation<GreetingService>> violations = executableValidator.validateConstructorParameters(
        constructor,
        parameterValues
    );

    assertCorrectConstraintViolationMessages(
View Full Code Here

Examples of javax.validation.executable.ExecutableValidator

        );
    config.addMapping( mapping );

    Constructor<GreetingService> constructor = GreetingService.class.getConstructor( String.class );

    ExecutableValidator executableValidator = getConfiguredExecutableValidator();

    Set<ConstraintViolation<GreetingService>> violations = executableValidator.validateConstructorReturnValue(
        constructor,
        new GreetingService( "" )
    );

    assertCorrectConstraintViolationMessages( violations, "invalid" );
View Full Code Here

Examples of javax.validation.executable.ExecutableValidator

        );
    config.addMapping( mapping );

    Constructor<GreetingService> constructor = GreetingService.class.getConstructor( String.class );

    ExecutableValidator executableValidator = getConfiguredExecutableValidator();

    Set<ConstraintViolation<GreetingService>> violations = executableValidator.validateConstructorReturnValue(
        constructor,
        new GreetingService( "" )
    );

    assertCorrectConstraintViolationMessages( violations, "invalid 1", "invalid 2" );
View Full Code Here

Examples of javax.validation.executable.ExecutableValidator

        );
    config.addMapping( mapping );

    Constructor<GreetingService> constructor = GreetingService.class.getConstructor( CharSequence.class );

    ExecutableValidator executableValidator = getConfiguredExecutableValidator();

    Set<ConstraintViolation<GreetingService>> violations = executableValidator.validateConstructorReturnValue(
        constructor,
        new GreetingService( "" )
    );

    assertCorrectConstraintViolationMessages( violations, "invalid 1", "invalid 2" );
View Full Code Here

Examples of javax.validation.executable.ExecutableValidator

        );
    config.addMapping( mapping );

    Constructor<GreetingService> constructor = GreetingService.class.getConstructor( String.class, String.class );

    ExecutableValidator executableValidator = getConfiguredExecutableValidator();

    Set<ConstraintViolation<GreetingService>> violations = executableValidator.validateConstructorReturnValue(
        constructor,
        new GreetingService( "", "" )
    );

    assertCorrectConstraintViolationMessages( violations, "default message" );
View Full Code Here

Examples of javax.validation.executable.ExecutableValidator

    config.addMapping( mapping );

    Constructor<GreetingService> constructor = GreetingService.class.getConstructor( String.class, String.class );
    Object[] parameterValues = new Object[] { "", "" };

    ExecutableValidator executableValidator = getConfiguredExecutableValidator();

    Set<ConstraintViolation<GreetingService>> violations = executableValidator.validateConstructorParameters(
        constructor,
        parameterValues
    );

    assertCorrectConstraintViolationMessages( violations, "default message" );
View Full Code Here

Examples of javax.validation.executable.ExecutableValidator

    }
  }

  @Test
  public void shouldValidateParameterScriptAssertConstraintOnConstructor() throws Exception {
    ExecutableValidator executableValidator = getValidator().forExecutables();

    Constructor<?> constructor = CalendarServiceImpl.class.getConstructor( String.class );
    Object[] parameterValues = new Object[] { "Foo" };

    Set<ConstraintViolation<Object>> violations = executableValidator.validateConstructorParameters(
        constructor,
        parameterValues
    );
    assertCorrectConstraintViolationMessages(
        violations,
View Full Code Here

Examples of javax.validation.executable.ExecutableValidator

    assertCorrectConstraintTypes( constraintViolations, Min.class );
  }

  @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

    assertCorrectConstraintTypes( constraintViolations, Max.class );
  }

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