AstNodeFactory { public AstNode node( String name ) { CheckArg.isNotNull(name, "name"); AstNode node = new AstNode(name); node.setProperty(JCR_PRIMARY_TYPE, NT_UNSTRUCTURED); return node; }  AstNode node( String name ); AstNode node( String name,
                         AstNode parent,
                         Object... types ); AstNode node( String name,
                         AstNode parent,
                         String type ); void setType( AstNode node,
                         String type ); List<AstNode> getChildrenForType( AstNode astNode,
                                             String nodeType ); AstNode getChildforNameAndType( AstNode astNode,
                                           String name,
                                           String nodeType ); boolean hasMixinType( AstNode node,
                                 String mixinType );  }
@Test public void shouldCreateChildNode() { String name = "myNodeName"; nodeFactory.node(name, rootNode, StandardDdlLexicon.TYPE_CREATE_TABLE_STATEMENT); assertThat(rootNode.getChildCount(), is(1)); assertEquals(rootNode.getProperty(JcrConstants.JCR_MIXIN_TYPES), StandardDdlLexicon.STATEMENTS_CONTAINER); assertEquals(rootNode.getChild(0).getProperty(JcrConstants.JCR_MIXIN_TYPES), StandardDdlLexicon.TYPE_CREATE_TABLE_STATEMENT); assertThat(rootNode.getChild(0).getName(), is(name)); }