@Test
  public void testParsingPropertyWithUnicodeCharacter() {
    PathImpl path = PathImpl.createPathFromString("höchst\u00f6Betrag");
    Iterator<Path.Node> it = path.iterator();

    assertEquals(it.next().getName(), "höchst\u00f6Betrag");
  }
  @Test
  public void testParsingPropertyWithCurrencySymbol() {
    PathImpl path = PathImpl.createPathFromString("€Amount");
    Iterator<Path.Node> it = path.iterator();

    assertEquals(it.next().getName(), "€Amount");
  }
 @Before
 public void setUp() {
   underTest = new UpdateStackRequestValidator();
   constraintValidatorContext =
       new ConstraintValidatorContextImpl(
           new ArrayList<String>(), PathImpl.createRootPath(), new DummyConstraintDescriptor());
 }
  @Test
  public void testParsing() {
    String property = "orders[3].deliveryAddress.addressline[1]";
    Path path = PathImpl.createPathFromString(property);
    Iterator<Path.Node> propIter = path.iterator();

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

    assertTrue(propIter.hasNext());
    elem = propIter.next();
    assertEquals(elem.getName(), "deliveryAddress");
    assertTrue(elem.isInIterable());
    assertEquals(elem.getIndex(), new Integer(3));

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

    assertTrue(propIter.hasNext());
    elem = propIter.next();
    assertEquals(elem.getName(), null);
    assertTrue(elem.isInIterable());
    assertEquals(elem.getIndex(), new Integer(1));

    assertFalse(propIter.hasNext());

    assertEquals(path.toString(), property);
  }
  @Test
  public void testCreationOfExecutablePath() throws Exception {
    Method executable = Container.class.getMethod("addItem", Key.class, Item.class);

    BeanMetaDataManager beanMetaDataManager =
        new BeanMetaDataManager(
            new ConstraintHelper(),
            new ExecutableHelper(new TypeResolutionHelper()),
            new ExecutableParameterNameProvider(new DefaultParameterNameProvider()),
            Collections.<MetaDataProvider>emptyList());

    ExecutableMetaData executableMetaData =
        beanMetaDataManager.getBeanMetaData(Container.class).getMetaDataFor(executable);

    PathImpl methodParameterPath = PathImpl.createPathForExecutable(executableMetaData);

    assertEquals(methodParameterPath.toString(), "addItem");
  }
  @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());

    assertTrue(propIter.hasNext());
    elem = propIter.next();
    assertEquals("deliveryAddress", elem.getName());
    assertTrue(elem.isInIterable());
    assertEquals("foo", elem.getKey());

    assertFalse(propIter.hasNext());
  }
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void testCreationOfExecutablePathFailsDueToMissingExecutable() throws Exception {
   PathImpl.createPathForExecutable(null);
 }
 @Test
 public void testEmptyString() {
   Path path = PathImpl.createPathFromString("");
   assertTrue(path.iterator().hasNext());
 }
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void testLeadingPathSeparator() {
   PathImpl.createPathFromString(".foo.bar");
 }
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void testIndexInMiddleOfProperty() {
   PathImpl.createPathFromString("f[1]oo.bar");
 }
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void testUnbalancedBraces() {
   PathImpl.createPathFromString("foo[.bar");
 }
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void testNull() {
   PathImpl.createPathFromString(null);
 }
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void testParsingInvalidJavaProperty() {
   PathImpl.createPathFromString("1invalid");
 }