ChangeCollectorProvider extends ValidatorProvider { @Override protected Validator getRootValidator(NodeState before, NodeState after, CommitInfo info) { if (!enabled) { return null; } if (info == null || !info.getInfo().containsKey(CommitContext.NAME)) { return null; } return ChangeCollector.newRootCollector(info, maxItems, maxPathDepth); }   static final String TYPE; static final String COMMIT_CONTEXT_OBSERVATION_CHANGESET; }
@Test public void testNull() { NodeBuilder builder = EMPTY_NODE.builder(); builder.setChildNode("test"); builder.setChildNode("a1").setChildNode("b1").setProperty("p1", 1); NodeState before = builder.getNodeState(); builder = before.builder(); builder.setChildNode("a2").setChildNode("b12").setProperty("p12", "12"); NodeState after = builder.getNodeState(); assertNull(collectorProvider.getRootValidator(before, after, null)); assertNull(collectorProvider.getRootValidator(before, after, CommitInfo.EMPTY)); assertNotNull(collectorProvider.getRootValidator(before, after, newCommitInfoWithCommitContext(CommitInfo.OAK_UNKNOWN, CommitInfo.OAK_UNKNOWN))); }