mk1.commit("/", "+\"test\":{}", null, null);
mk1.runBackgroundOperations();
DocumentMK mk2 = createMK(2, 0);
DocumentMK mk3 = createMK(3, 0);
KernelNodeStore ns3 = new KernelNodeStore(mk3);
// the next line is required for the test even if it
// just reads from the node store. do not remove!
traverse(ns3.getRoot(), "/");
String b3 = mk3.branch(null);
b3 = mk3.commit("/", "+\"mk3\":{}", b3, null);
assertTrue(mk3.nodeExists("/test", b3));
mk2.commit("/", "+\"test/mk21\":{}", null, null);
mk2.runBackgroundOperations();
mk3.runBackgroundOperations(); // pick up changes from mk2
String base3 = mk3.getHeadRevision();
assertFalse(mk3.nodeExists("/test/mk21", b3));
b3 = mk3.rebase(b3, base3);
mk2.commit("/", "+\"test/mk22\":{}", null, null);
mk2.runBackgroundOperations();
mk3.runBackgroundOperations(); // pick up changes from mk2
NodeState base = ns3.retrieve(base3); // branch base
assertNotNull(base);
NodeState branchHead = ns3.retrieve(b3);
assertNotNull(branchHead);
TrackingDiff diff = new TrackingDiff();
branchHead.compareAgainstBaseState(base, diff);
assertEquals(1, diff.added.size());
assertEquals(Sets.newHashSet("/mk3"), diff.added);