Package javax.validation

Examples of javax.validation.Path$CrossParameterNode


        super(name);
    }

    public void testParsing() {
        String property = "order[3].deliveryAddress.addressline[1]";
        Path path = PathImpl.createPathFromString(property);
        assertEquals(property, path.toString());

        Iterator<Path.Node> propIter = path.iterator();

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


        assertFalse(propIter.hasNext());
    }

    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();
        assertFalse(elem.isInIterable());
        assertEquals("order", elem.getName());
View Full Code Here

    }

    //some of the examples from the 1.0 bean validation spec, section 4.2
    public void testSpecExamples() {
        String fourthAuthor = "authors[3]";
        Path path = PathImpl.createPathFromString(fourthAuthor);
        Iterator<Path.Node> propIter = path.iterator();

        assertTrue(propIter.hasNext());
        Path.Node elem = propIter.next();
        assertFalse(elem.isInIterable());
        assertEquals("authors", elem.getName());

        assertTrue(propIter.hasNext());
        elem = propIter.next();
        assertTrue(elem.isInIterable());
        assertEquals(3, elem.getIndex().intValue());
        assertNull(elem.getName());
        assertFalse(propIter.hasNext());

        String firstAuthorCompany = "authors[0].company";
        path = PathImpl.createPathFromString(firstAuthorCompany);
        propIter = path.iterator();

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

    public void testNull() {
        assertEquals(PathImpl.createPathFromString(null), PathImpl.create(null));

        assertEquals("", PathImpl.create(null).toString());
        Path path = PathImpl.create(null);
        Path.Node node = path.iterator().next();
        assertEquals(null, node.getName());
    }
View Full Code Here

        } catch (ValidationException ex) {
        }
    }

    public void testEmptyString() {
        Path path = PathImpl.createPathFromString("");
        assertEquals(null, path.iterator().next().getName());
    }
View Full Code Here

        messageTemplate,
        localContext.getCurrentValidatedValue(),
        descriptor,
        constraintViolationCreationContext.getExpressionVariables()
    );
    Path path = constraintViolationCreationContext.getPath();

    if ( executableParameters != null ) {
      return ConstraintViolationImpl.forParameterValidation(
          messageTemplate,
          interpolatedMessage,
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

        "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

TOP

Related Classes of javax.validation.Path$CrossParameterNode

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.