### Question:
PropertyIterator { public void split() { if ( tail == null ) { return; } String[] tokens = tail.split( "\\.", 2 ); head = tokens[0]; index = null; if ( head.contains( "[" ) ) { head = tokens[0].substring( 0, tokens[0].indexOf( "[" ) ); index = tokens[0].substring( tokens[0].indexOf( "[" ) + 1, tokens[0].indexOf( "]" ) ); } if ( tokens.length > 1 ) { tail = tokens[1]; } else { tail = null; } } PropertyIterator(String property); boolean hasNext(); void split(); String getOriginalProperty(); String getHead(); String getTail(); String getIndex(); boolean isIndexed();  }### Answer:
@Test public void testSplit() { String property = "order[3].deliveryAddress.addressline[1]"; PropertyIterator propIter = new PropertyIterator( property ); assertTrue( propIter.hasNext() ); propIter.split(); assertTrue( propIter.hasNext() ); assertEquals( "order", propIter.getHead() ); assertTrue( propIter.isIndexed() ); assertEquals( "3", propIter.getIndex() ); assertEquals( "deliveryAddress.addressline[1]", propIter.getTail() ); assertEquals( property, propIter.getOriginalProperty() ); propIter.split(); assertTrue( propIter.hasNext() ); assertEquals( "deliveryAddress", propIter.getHead() ); assertFalse( propIter.isIndexed() ); assertEquals( null, propIter.getIndex() ); assertEquals( "addressline[1]", propIter.getTail() ); assertEquals( property, propIter.getOriginalProperty() ); propIter.split(); assertFalse( propIter.hasNext() ); assertEquals( "addressline", propIter.getHead() ); assertTrue( propIter.isIndexed() ); assertEquals( "1", propIter.getIndex() ); assertEquals( null, propIter.getTail() ); assertEquals( property, propIter.getOriginalProperty() ); }