in src/main/java/org/apache/sling/testing/mock/jcr/MockSession.java [218:235]
RangeIterator listChildren(final String parentPath, final ItemFilter filter) throws RepositoryException {
List<Item> children = new ArrayList<Item>();
//remove trailing slash or make root path / empty string
final String path = parentPath.replaceFirst("/$", "");
// build regex pattern for all child paths of parent
Pattern pattern = Pattern.compile("^" + Pattern.quote(path) + "/[^/]+$");
// collect child resources
for (ItemData item : this.items.values()) {
if (pattern.matcher(item.getPath()).matches() && (filter == null || filter.accept(item))) {
children.add(item.getItem(this));
}
}
return new RangeIteratorAdapter(children.iterator(), children.size());
}