Ejemplo n.º 1
0
  public void testDeepEqualsWhenDeltaAreNotEquals() throws Exception {
    Amendment a1 =
        Fixtures.createAmendment("Amendment", DateTools.createDate(2007, Calendar.APRIL, 6));
    Amendment a2 =
        Fixtures.createAmendment("Amendment", DateTools.createDate(2007, Calendar.APRIL, 6));
    Epoch epoch1 = new Epoch();
    epoch1.setName("Epoch");
    epoch1.setGridId("GridId1");
    Delta<Epoch> delta1 = Delta.createDeltaFor(epoch1);
    delta1.setGridId("delta1");
    delta1.addChanges(PropertyChange.create("name", "A", "C"), Add.create(new StudySegment()));
    a1.addDelta(delta1);
    Epoch epoch2 = new Epoch();
    epoch2.setName("Epoch");
    epoch2.setGridId("GridId1");
    Delta<Epoch> delta2 = Delta.createDeltaFor(epoch2);
    delta2.setGridId("delta1");
    delta2.addChanges(PropertyChange.create("name", "A", "B"), Add.create(new StudySegment()));
    a2.addDelta(delta2);
    Differences differences = a1.deepEquals(a2);
    assertFalse(differences.getChildDifferences().isEmpty());

    assertChildDifferences(
        differences,
        new String[] {"delta for epoch GridId1", "property change for name"},
        "new value \"C\" does not match \"B\"");
  }
Ejemplo n.º 2
0
 public void testFindMatchingDelta() throws Exception {
   Amendment a1 =
       Fixtures.createAmendment("Amendment", DateTools.createDate(2007, Calendar.APRIL, 6));
   Epoch epoch1 = new Epoch();
   epoch1.setGridId("epoch1");
   Delta<Epoch> delta1 = Delta.createDeltaFor(epoch1);
   delta1.setGridId("delta1");
   a1.addDelta(delta1);
   Delta actualDelta = a1.getMatchingDelta("delta1", "epoch1", delta1.getClass());
   assertNotNull("Delta not found", actualDelta);
 }
Ejemplo n.º 3
0
 public void testDeepEqualsWhenNoDeltaFoundInAmendment() throws Exception {
   Amendment a1 =
       Fixtures.createAmendment("Amendment", DateTools.createDate(2007, Calendar.APRIL, 6));
   Amendment a2 =
       Fixtures.createAmendment("Amendment", DateTools.createDate(2007, Calendar.APRIL, 6));
   Epoch epoch1 = new Epoch();
   epoch1.setGridId("epoch1");
   Delta<Epoch> delta1 = Delta.createDeltaFor(epoch1);
   delta1.setGridId("delta1");
   delta1.addChanges(PropertyChange.create("name", "A", "B"), Add.create(new StudySegment()));
   a1.addDelta(delta1);
   StudySegment segment1 = new StudySegment();
   segment1.setGridId("segment1");
   Delta<StudySegment> delta2 = Delta.createDeltaFor(segment1);
   delta2.setGridId("delta1");
   delta2.addChanges(PropertyChange.create("name", "A", "B"), Add.create(new StudySegment()));
   a2.addDelta(delta2);
   Differences differences = a1.deepEquals(a2);
   assertFalse(differences.getMessages().isEmpty());
   assertEquals(
       "Amendments are equals",
       "no delta for epoch epoch1 found",
       differences.getMessages().get(0));
 }