JcrNodeTypeManager implements NodeTypeManager { @Override public boolean hasNodeType( String nodeTypeName ) { Name ntName = context().getValueFactories().getNameFactory().create(nodeTypeName); return nodeTypes().hasNodeType(ntName); } JcrNodeTypeManager( JcrSession session,
                        RepositoryNodeTypeManager repositoryTypeManager ); @Override NodeTypeIterator getAllNodeTypes(); @Override NodeTypeIterator getMixinNodeTypes(); @Override JcrNodeType getNodeType( String nodeTypeName ); @Override boolean hasNodeType( String nodeTypeName ); @Override NodeTypeIterator getPrimaryNodeTypes(); @Override NodeType registerNodeType( NodeTypeDefinition template,
                                      boolean allowUpdate ); NodeTypeIterator registerNodeTypes( Collection<NodeTypeDefinition> templates,
                                               boolean allowUpdates ); NodeTypeIterator registerNodeTypes( Iterable<NodeTypeDefinition> nodeTypes ); @Override NodeTypeIterator registerNodeTypes( NodeTypeDefinition[] ntds,
                                               boolean allowUpdate ); @Override void unregisterNodeType( String nodeTypeName ); void unregisterNodeTypes( Collection<String> nodeTypeNames ); @Override void unregisterNodeTypes( String[] names ); @Override NodeTypeTemplate createNodeTypeTemplate(); @Override @SuppressWarnings( "unchecked" ) NodeTypeTemplate createNodeTypeTemplate( NodeTypeDefinition ntd ); @Override NodeDefinitionTemplate createNodeDefinitionTemplate(); @Override PropertyDefinitionTemplate createPropertyDefinitionTemplate(); boolean isDerivedFrom( String[] testTypeNames,
                                  String primaryTypeName,
                                  String[] mixinNames ); @Override NodeTypeIterator registerNodeTypes( File file,
                                               boolean allowUpdate ); @Override NodeTypeIterator registerNodeTypes( InputStream stream,
                                               boolean allowUpdate ); @Override NodeTypeIterator registerNodeTypes( URL url,
                                               boolean allowUpdate );  }
@Test public void shouldReturnTrueForHasNodeTypeWithExistingNodeTypeName() throws Exception { assertTrue(nodeTypeMgr.hasNodeType("nt:base")); assertTrue(nodeTypeMgr.hasNodeType(HIERARCHY_NODE_TYPE)); assertTrue(nodeTypeMgr.hasNodeType(MIXIN1)); }
@Test public void shouldReturnFalseForHasNodeTypeWithNonexistantNodeTypeName() throws Exception { assertFalse(nodeTypeMgr.hasNodeType("someArgleBargle")); assertFalse(nodeTypeMgr.hasNodeType(HIERARCHY_NODE_TYPE + "x")); }