CommitBuilder { @NotNull CommitBuilder removeNode(@NotNull Path path, @NotNull NodeState state) throws DocumentStoreException { checkNotNull(path); checkNotNull(state); if (operations.containsKey(path)) { String msg = "Node already removed: " + path; throw new DocumentStoreException(msg); } removedNodes.add(path); UpdateOp op = getUpdateOperationForNode(path); op.setDelete(true); NodeDocument.setDeleted(op, revision, true); for (PropertyState p : state.getProperties()) { updateProperty(path, p.getName(), null); } return this; } CommitBuilder(@NotNull DocumentNodeStore nodeStore,
                  @Nullable RevisionVector baseRevision);   CommitBuilder(@NotNull DocumentNodeStore nodeStore,
                  @NotNull Revision revision,
                  @Nullable RevisionVector baseRevision);   }
@Test public void removeNode() { DocumentNodeState bar = addNode("bar"); CommitBuilder builder = new CommitBuilder(ns, null); Path path = Path.fromString("/bar"); builder.removeNode(path, bar); Commit c = builder.build(ns.newRevision()); UpdateOp up = c.getUpdateOperationForNode(path); UpdateOp.Operation op = up.getChanges().get( new UpdateOp.Key("_deleted", c.getRevision())); assertNotNull(op); }
@Test public void removeNodeStateNull() { CommitBuilder builder = new CommitBuilder(ns, null); try { builder.removeNode(Path.fromString("/bar"), null); expectNPE(); } catch (NullPointerException e) { } }