in src/main/java/org/apache/sling/testing/mock/jcr/MockNodeType.java [255:275]
public NodeTypeIterator getDeclaredSubtypes() {
if (ntMgr != null && ((MockNodeTypeManager)ntMgr).isMode(ResolveMode.MOCK_ALL)) {
throw new UnsupportedOperationException();
}
List<NodeType> subtypes = new ArrayList<>();
if (ntMgr != null) {
try {
NodeTypeIterator allNodeTypes = ntMgr.getAllNodeTypes();
while (allNodeTypes.hasNext()) {
NodeType nextNodeType = allNodeTypes.nextNodeType();
boolean issubtype = Stream.of(nextNodeType.getDeclaredSupertypes()).anyMatch(nt -> nt.getName().equals(getName()));
if (issubtype) {
subtypes.add(nextNodeType);
}
}
} catch (RepositoryException e) {
throw new RuntimeException("Getting declared subtype failed.", e);
}
}
return new NodeTypeIteratorAdapter(subtypes);
}