LoggingHook implements CommitHook, NodeStateDiff { @Override public boolean childNodeAdded(String name, NodeState after) { writer.accept("n+ " + safeEncode(name)); this.enter(null, after); boolean ret = after.compareAgainstBaseState(EmptyNodeState.EMPTY_NODE, this); this.leave(null, after); return ret; } private  LoggingHook(final Consumer<String> writer); void enter(NodeState before, NodeState after); void leave(NodeState before, NodeState after); @Override boolean propertyAdded(PropertyState after); @Override boolean propertyChanged(PropertyState before, PropertyState after); @Override boolean propertyDeleted(PropertyState before); @Override boolean childNodeAdded(String name, NodeState after); @Override boolean childNodeChanged(String name, NodeState before, NodeState after); @Override boolean childNodeDeleted(String name, NodeState before); @NotNull @Override NodeState processCommit(NodeState before, NodeState after, CommitInfo info);  }
@Test public void testChildNodeAdded() throws Exception { assertCommitProduces( lines( "n+ chi%25:ld", "n!", "n!" ), root -> root.setChildNode("chi%:ld") ); }