public class PathImplTest {
@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 );
}