Package javax.validation

Examples of javax.validation.Path$ConstructorNode


        "Wrong number of property paths. Expected: " + propertyPaths.length + " Actual: " + propertyPathsOfViolations
            .size()
    );

    for ( String propertyPath : propertyPaths ) {
      Path expectedPath = PathImpl.createPathFromString( propertyPath );
      boolean containsPath = false;
      for ( Path actualPath : propertyPathsOfViolations ) {
        if ( assertEqualPaths( expectedPath, actualPath ) ) {
          containsPath = true;
          break;
View Full Code Here


      }
    }
  }

  public static <T> void assertConstraintViolation(ConstraintViolation<T> violation, Class<?> rootBean, Object invalidValue, String propertyPath) {
    Path expectedPath = PathImpl.createPathFromString( propertyPath );
    if ( !assertEqualPaths( violation.getPropertyPath(), expectedPath ) ) {
      fail( "Property paths differ. Actual: " + violation.getPropertyPath() + " Expected: " + expectedPath );
    }

    assertEquals(
View Full Code Here

  private boolean isReachable(ValidationContext<?> validationContext, Object traversableObject, PathImpl path, ElementType type) {
    if ( needToCallTraversableResolver( path, type ) ) {
      return true;
    }

    Path pathToObject = path.getPathWithoutLeafNode();
    try {
      return validationContext.getTraversableResolver().isReachable(
          traversableObject,
          path.getLeafNode(),
          validationContext.getRootBeanClass(),
View Full Code Here

    boolean isReachable = isReachable( validationContext, traversableObject, path, type );
    if ( !isReachable ) {
      return false;
    }

    Path pathToObject = path.getPathWithoutLeafNode();
    try {
      return validationContext.getTraversableResolver().isCascadable(
          traversableObject,
          path.getLeafNode(),
          validationContext.getRootBeanClass(),
View Full Code Here

    for ( ConstraintViolation<?> violation : violations ) {
      propertyPathsOfViolations.add( violation.getPropertyPath() );
    }

    for ( String propertyPath : propertyPaths ) {
      Path expectedPath = PathImpl.createPathFromString( propertyPath );
      boolean containsPath = false;
      for ( Path actualPath : propertyPathsOfViolations ) {
        if ( assertEqualPaths( expectedPath, actualPath ) ) {
          containsPath = true;
          break;
View Full Code Here

        localContext.getCurrentValidatedValue(),
        descriptor,
        constraintViolationCreationContext.getExpressionVariables()
    );
    // at this point we make a copy of the path to avoid side effects
    Path path = PathImpl.createCopy( constraintViolationCreationContext.getPath() );

    if ( executableParameters != null ) {
      return ConstraintViolationImpl.forParameterValidation(
          messageTemplate,
          interpolatedMessage,
View Full Code Here

  }

  @Test
  public void testParseMapBasedProperty() {
    String property = "order[foo].deliveryAddress";
    Path path = PathImpl.createPathFromString( property );
    Iterator<Path.Node> propIter = path.iterator();

    assertTrue( propIter.hasNext() );
    Path.Node elem = propIter.next();
    assertEquals( "order", elem.getName() );
    assertFalse( elem.isInIterable() );
View Full Code Here

    PathImpl.createPathFromString( ".foo.bar" );
  }

  @Test
  public void testEmptyString() {
    Path path = PathImpl.createPathFromString( "" );
    assertTrue( path.iterator().hasNext() );
  }
View Full Code Here

    Key id = new Key();
    container.addItem( id, new Item( null ) );
    Set<ConstraintViolation<Container>> constraintViolations = validator.validate( container );
    assertNumberOfViolations( constraintViolations, 1 );
    ConstraintViolation<Container> violation = constraintViolations.iterator().next();
    Path path = violation.getPropertyPath();
    Iterator<Path.Node> iter = path.iterator();
    iter.next();
    Path.Node node = iter.next();
    assertNotNull( node );
    assertTrue( node.isInIterable() );
    assertEquals( node.getKey(), id );
View Full Code Here

    ConstraintViolation<CustomerRepositoryImpl> constraintViolation = violations.iterator().next();
    assertThat( constraintViolation.getMessage() ).isEqualTo( messagePrefix() + "may not be null" );
    assertThat( constraintViolation.getRootBeanClass() ).isEqualTo( CustomerRepositoryImpl.class );
    assertThat( constraintViolation.getInvalidValue() ).isNull();

    Path path = constraintViolation.getPropertyPath();
    assertNodeKinds( path, ElementKind.CONSTRUCTOR, ElementKind.PARAMETER, ElementKind.PROPERTY );
    assertNodeNames( path, "CustomerRepositoryImpl", "arg0", "name" );
  }
View Full Code Here

TOP

Related Classes of javax.validation.Path$ConstructorNode

Copyright © 2018 www.massapicom. 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.