@Test public void shouldReturnIteratorOfChildren() { parent = new AstNode("parent"); AstNode child1 = new AstNode(parent, "childA"); AstNode child2 = new AstNode(parent, "childB"); AstNode child3 = new AstNode(parent, "childC"); Iterator<AstNode> children = parent.iterator(); assertThat(children.next(), is(sameInstance(child1))); assertThat(children.next(), is(sameInstance(child2))); assertThat(children.next(), is(sameInstance(child3))); assertThat(children.hasNext(), is(false)); }
@Override public Iterator<AstNode> iterator() { return childrenView.iterator(); }
AstNode implements Iterable<AstNode>, Cloneable { @Override public Iterator<AstNode> iterator() { return childrenView.iterator(); } }
AstNode implements Iterable<AstNode>, Cloneable { @Override public Iterator<AstNode> iterator() { return childrenView.iterator(); } AstNode( String name );  AstNode( AstNode parent,
                    String name ); }
AstNode implements Iterable<AstNode>, Cloneable { @Override public Iterator<AstNode> iterator() { return childrenView.iterator(); } AstNode( String name );  AstNode( AstNode parent,
                    String name ); boolean addMixin( final String mixin ); boolean hasMixin( final String mixin ); String getName(); String getPrimaryType(); int getSameNameSiblingIndex(); String getAbsolutePath(); Object getProperty( String name ); AstNode setProperty( String name,
                                Object value ); AstNode setProperty( String name,
                                Object... values ); Object removeProperty( String name ); List<String> getPropertyNames(); @SuppressWarnings( "unchecked" ) List<String> getMixins(); AstNode getParent(); void setParent( AstNode parent ); void insertAsParent( AstNode newParent ); AstNode removeFromParent(); boolean replaceChild( AstNode child,
                                 AstNode replacement ); int getChildCount(); AstNode getFirstChild(); AstNode getLastChild(); List<AstNode> childrenWithName( final String name ); AstNode getChild( int index ); void addFirstChild( AstNode child ); void addLastChild( AstNode child ); void addChildren( Iterable<AstNode> otherChildren ); void addChildren( AstNode first,
                             AstNode second ); void addChildren( AstNode first,
                             AstNode second,
                             AstNode third ); boolean removeChild( AstNode child ); void extractChild( AstNode child ); void extractFromParent(); List<AstNode> getChildren(); List<AstNode> getChildren( final String mixin ); @Override Iterator<AstNode> iterator(); List<AstNode> removeAllChildren(); boolean isSameAs( AstNode other ); @Override AstNode clone(); @Override String toString(); }
AstNode implements Iterable<AstNode>, Cloneable { @Override public Iterator<AstNode> iterator() { return childrenView.iterator(); } AstNode( String name );  AstNode( AstNode parent,
                    String name ); boolean addMixin( final String mixin ); boolean hasMixin( final String mixin ); String getName(); String getPrimaryType(); int getSameNameSiblingIndex(); String getAbsolutePath(); Object getProperty( String name ); AstNode setProperty( String name,
                                Object value ); AstNode setProperty( String name,
                                Object... values ); Object removeProperty( String name ); List<String> getPropertyNames(); @SuppressWarnings( "unchecked" ) List<String> getMixins(); AstNode getParent(); void setParent( AstNode parent ); void insertAsParent( AstNode newParent ); AstNode removeFromParent(); boolean replaceChild( AstNode child,
                                 AstNode replacement ); int getChildCount(); AstNode getFirstChild(); AstNode getLastChild(); List<AstNode> childrenWithName( final String name ); AstNode getChild( int index ); void addFirstChild( AstNode child ); void addLastChild( AstNode child ); void addChildren( Iterable<AstNode> otherChildren ); void addChildren( AstNode first,
                             AstNode second ); void addChildren( AstNode first,
                             AstNode second,
                             AstNode third ); boolean removeChild( AstNode child ); void extractChild( AstNode child ); void extractFromParent(); List<AstNode> getChildren(); List<AstNode> getChildren( final String mixin ); @Override Iterator<AstNode> iterator(); List<AstNode> removeAllChildren(); boolean isSameAs( AstNode other ); @Override AstNode clone(); @Override String toString();  }