Esempio n. 1
0
 public void testFindMatchingChildPeriodByNameWhenNameUnique() throws Exception {
   Period p1 = setGridId("GRID-1", createPeriod("P1", 4, 7, 1));
   Period p2 = setGridId("GRID-2", createPeriod("P2", 4, 7, 1));
   studySegment.addPeriod(p1);
   studySegment.addPeriod(p2);
   assertSame("Not found", p2, studySegment.findNaturallyMatchingChild("P2"));
 }
Esempio n. 2
0
  public void testMergeWithNoOtherChanges() throws Exception {
    remove.setChild(ssa);
    remove.mergeInto(delta, NOW);

    assertEquals("Remove should have been added", 1, delta.getChanges().size());
    assertSame(remove, delta.getChanges().get(0));
    assertEquals("Updated date not set", NOW, remove.getUpdatedDate());
  }
Esempio n. 3
0
 public void testAddPeriod() {
   Period period = new Period();
   studySegment.addPeriod(period);
   assertEquals("wrong number of periods", 1, studySegment.getPeriods().size());
   assertSame("wrong period present", period, studySegment.getPeriods().iterator().next());
   assertEquals(
       "bidirectional relationship not maintained", studySegment, period.getStudySegment());
 }
Esempio n. 4
0
 public void testSetChildIdKeepsChildIfIdsMatch() throws Exception {
   StudySegment expectedChild = setId(15, new StudySegment());
   remove.setChild(expectedChild);
   remove.setChildId(expectedChild.getId());
   assertSame("New child incorrectly cleared", expectedChild, remove.getChild());
 }