예제 #1
0
  public void testInsertEmpty() {
    CollectionLeaf leaf =
        new CollectionLeaf(new SequenceNumber(1), 0, AboraConverter.toAboraContent("hello"));
    BeEdition edition = new BeEdition();
    RootNode root = new RootNode(edition, new SequenceNumber(1));

    root.insert(leaf);

    assertEquals(leaf, root.getChild());
    assertEquals(1, leaf.getParents().size());
    assertTrue(leaf.getParents().contains(root));
  }
예제 #2
0
 public void testCreateWithDsp() {
   CollectionLeaf leaf =
       new CollectionLeaf(new SequenceNumber(1), 1, AboraConverter.toAboraContent("hello"));
   BeEdition edition = new BeEdition();
   RootNode root = new RootNode(edition, new SequenceNumber(10), leaf, 9);
   assertEquals(new SequenceNumber(10), root.getBranch());
   assertEquals(9, root.getDsp());
   assertEquals(leaf, root.getChild());
   assertEquals(edition, root.getEdition());
   assertEquals(1, leaf.getParents().size());
   assertTrue(leaf.getParents().contains(root));
 }
예제 #3
0
  public void testInsertEmptyBadRevision() {
    CollectionLeaf leaf =
        new CollectionLeaf(new SequenceNumber(2), 1, AboraConverter.toAboraContent("hello"));
    BeEdition edition = new BeEdition();
    RootNode root = new RootNode(edition, new SequenceNumber(1));

    try {
      root.insert(leaf);
      fail("2");
    } catch (NonSameBranchException e) {
      // expecteded
    }

    assertEquals(null, root.getChild());
    assertEquals(0, leaf.getParents().size());
  }