Beispiel #1
0
 @Test
 public void insert1() throws Exception {
   Rating rt = OpenJadeUtil.makeRating("a1", "a2", 0, "great");
   String hashRoot = md5(rt);
   dm.insert(rt);
   assertEquals(1, dm.getRatings().size());
   assertEquals(0, rt.getIndex());
   assertNotNull(dm.getTree());
   assertNotNull(dm.getTree().getNode());
   assertEquals(hashRoot, dm.getTree().getNode().getValue());
   assertEquals(hashRoot, dm.getNode(hashRoot).getValue());
 }
Beispiel #2
0
  @Test
  public void insertImpar() throws Exception {
    Rating rt1 = makeRating("a1", "a2", 1, "great");
    Rating rt2 = makeRating("a1", "a2", 2, "great");
    Rating rt3 = makeRating("a1", "a2", 3, "great");
    dm.insert(rt1);
    dm.insert(rt2);
    dm.insert(rt3);

    String hashRoot = md5(md5(md5(rt1) + md5(rt2)) + md5(md5(rt3) + md5(rt3)));
    assertEquals(md5(rt3), dm.getNode(md5(rt3)).getValue());
    assertEquals(3, dm.getRatings().size());
    assertEquals(hashRoot, dm.getTree().getNode().getValue());
  }