Ejemplo n.º 1
0
  public void testCloneDeepClonesDeltas() throws Exception {
    Amendment src = Fixtures.createAmendment(null, DateTools.createDate(2008, Calendar.JUNE, 22));
    src.addDelta(Delta.createDeltaFor(new Study()));

    Amendment clone = src.clone();
    assertEquals("Wrong number of cloned changes", 1, clone.getDeltas().size());
    assertNotSame("Deltas not deep cloned", src.getDeltas().get(0), clone.getDeltas().get(0));
  }
Ejemplo n.º 2
0
  public void testCloneDeepClonesPreviousAmendments() throws Exception {
    Amendment src = Fixtures.createAmendments("C", "B", "A");
    Amendment clone = src.clone();

    assertNotSame(
        "Previous amendment not cloned", src.getPreviousAmendment(), clone.getPreviousAmendment());
    assertNotSame(
        "Previous previous amendment not cloned",
        src.getPreviousAmendment().getPreviousAmendment(),
        clone.getPreviousAmendment().getPreviousAmendment());
  }