Ejemplo n.º 1
0
 private void verifyDiffMatch(Diff diff, Object object1, Object object2) {
   assertEquals(object1, diff.getObject1());
   assertEquals(object2, diff.getObject2());
   assertTrue(diff.identical());
   assertFalse(diff.different());
   assertEquals(0, diff.getDescription().length());
 }
Ejemplo n.º 2
0
  public void testMissingElements() {
    this.list2.remove(4);
    OrderedContainerDiff diff =
        (OrderedContainerDiff) this.differentiator.diff(this.list1, this.list2);
    this.verifyDiffMatchMismatch(diff, this.list1, this.list2);

    Diff[] diffs = diff.getDiffs();
    assertEquals(this.list1.size(), diffs.length);
    OrderedContainerElementDiff oced;
    oced = (OrderedContainerElementDiff) diffs[0];
    assertTrue(oced.identical());
    oced = (OrderedContainerElementDiff) diffs[1];
    assertTrue(oced.identical());
    oced = (OrderedContainerElementDiff) diffs[2];
    assertTrue(oced.identical());
    oced = (OrderedContainerElementDiff) diffs[3];
    assertTrue(oced.identical());
    Diff moced = diffs[4];
    assertTrue(moced.different());
    assertTrue(moced.getObject1().equals("four"));
    assertTrue(moced.getObject2().toString().equals("<undefined>"));
  }