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")); }
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()); }
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()); }
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()); }