Exemplo n.º 1
0
  public void testAddMultiplePeriod() {
    studySegment = new StudySegment();
    Period period = createPeriod("name", 3, Duration.Unit.day, 15, 3);
    Period anotherPeriod = createPeriod("name", 3, Duration.Unit.day, 15, 3);
    studySegment.addPeriod(period);
    studySegment.addPeriod(anotherPeriod);

    assertEquals(
        "wrong number of periods because both periods are same",
        1,
        studySegment.getPeriods().size());

    studySegment = new StudySegment();

    period.setId(1);
    studySegment.addPeriod(period);
    studySegment.addPeriod(anotherPeriod);

    assertEquals("wrong number of periods", 2, studySegment.getPeriods().size());
  }