ChildNodeStateProvider { @NotNull public Iterable<? extends ChildNodeEntry> getChildNodeEntries() { return () -> transform(children(), p -> new MemoryChildNodeEntry(name(p), p.getNodeState())); } ChildNodeStateProvider(Iterable<NodeStateEntry> entries, String path, Set<String> preferredPathElements); boolean hasChildNode(@NotNull String name); @NotNull NodeState getChildNode(@NotNull String name); long getChildNodeCount(long max); Iterable<String> getChildNodeNames(); @NotNull Iterable<? extends ChildNodeEntry> getChildNodeEntries();  }
@Test public void childEntries() { Set<String> preferred = ImmutableSet.of("jcr:content"); CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/jcr:content", "/a/c", "/a/d", "/e", "/e/f")); ChildNodeStateProvider p = new ChildNodeStateProvider(citr, "/a", preferred); Map<String, NodeState> children = new HashMap<>(); p.getChildNodeEntries().forEach(e -> children.put(e.getName(), e.getNodeState())); assertThat(children.keySet(), containsInAnyOrder("jcr:content", "c", "d")); assertEquals("/a/jcr:content", children.get("jcr:content").getString("path")); assertEquals("/a/d", children.get("d").getString("path")); assertEquals("/a/c", children.get("c").getString("path")); }