putPerson("Max", 3);
long c1 = _master.commit();
putPerson("Peter", 26);
long c2 = _master.commit();
VHistory h = _db.getHistory();
assertEquals(c1, h.getParent(c2));
assertEquals(root, h.getParent(c1));
assertEquals(0, h.getParent(root));
assertArrayEquals(new long[] { root }, h.getChildren(0));
assertArrayEquals(new long[] { c1 }, h.getChildren(root));
assertArrayEquals(new long[] { c2 }, h.getChildren(c1));
assertArrayEquals(new long[0], h.getChildren(c2));
VBranch master2 = _db.createBranch("master2", c1);
VCollection persons = master2.getCollection("persons");
persons.insert(_factory.createDocument("name", "Elvis"));
long c3 = master2.commit();
h = _db.getHistory();
assertEquals(c1, h.getParent(c2));
assertEquals(c1, h.getParent(c3));
assertEquals(root, h.getParent(c1));
assertEquals(0, h.getParent(root));
assertArrayEquals(new long[] { root }, h.getChildren(0));
assertArrayEquals(new long[] { c1 }, h.getChildren(root));
long[] c1c = h.getChildren(c1);
assertEquals(2, c1c.length);
assertTrue((c1c[0] == c2 && c1c[1] == c3) || (c1c[0] == c3 && c1c[1] == c2));
assertArrayEquals(new long[0], h.getChildren(c2));
assertArrayEquals(new long[0], h.getChildren(c3));
}