### Question:
AstNode implements Iterable<AstNode> { public int getChildCount() { return this.children.size(); } AstNode( Name name );  AstNode( AstNode parent,
                    Name name ); Name getName(); int getSameNameSiblingIndex(); Path getPath( ExecutionContext context ); Path getPathRelativeTo( Path rootPath,
                                   ExecutionContext context ); Property getProperty( Name name ); AstNode setProperty( Name name,
                                Object value ); AstNode setProperty( Name name,
                                Object... values ); Property removeProperty( Name name ); List<Property> getProperties(); AstNode getParent(); void setParent( AstNode parent ); void insertAsParent( AstNode newParent ); AstNode removeFromParent(); boolean replaceChild( AstNode child,
                                 AstNode replacement ); int getChildCount(); AstNode getFirstChild(); AstNode getLastChild(); 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(); Iterator<AstNode> iterator(); List<AstNode> removeAllChildren(); @Override String toString(); @Override final boolean equals( Object obj ); @Override AstNode clone(); boolean isSameAs( AstNode other ); String getString( ExecutionContext context );  }### Answer:
@Test public void shouldReturnCorrectChildCount() { parent = new AstNode(name("parent")); assertThat(parent.getChildCount(), is(0)); for (int i = 0; i != 10; ++i) { new AstNode(parent, name("child")); assertThat(parent.getChildCount(), is(i + 1)); } }