### Question:
AstNodeFactory { public AstNode node( String name ) { assert name != null; AstNode node = new AstNode(name(name)); node.setProperty(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.UNSTRUCTURED); return node; } AstNodeFactory( ExecutionContext context );  AstNodeFactory(); Name name( String name ); AstNode node( String name ); AstNode node( String name,
                         AstNode parent,
                         Object... types ); AstNode node( String name,
                         AstNode parent,
                         Name type ); void setType( AstNode node,
                         Name type ); List<AstNode> getChildrenForType( AstNode astNode,
                                             Name nodeType ); AstNode getChildforNameAndType( AstNode astNode,
                                           String name,
                                           Name nodeType ); boolean hasMixinType( AstNode node,
                                 Name mixinType ); int createInt( String stringValue );  }### Answer:
@Test public void shouldCreateChildNode() { String name = "myNodeName"; nodeFactory.node(name, rootNode, StandardDdlLexicon.TYPE_CREATE_TABLE_STATEMENT); assertThat(rootNode.getChildCount(), is(1)); assertEquals(rootNode.getProperty(JcrLexicon.MIXIN_TYPES).getFirstValue(), StandardDdlLexicon.STATEMENTS_CONTAINER); assertEquals(rootNode.getChild(0).getProperty(JcrLexicon.MIXIN_TYPES).getFirstValue(), StandardDdlLexicon.TYPE_CREATE_TABLE_STATEMENT); assertThat(rootNode.getChild(0).getName().getString(), is(name)); }