private void givenValidLoadTimeLine() { conceptName = "bla"; loadTimeLine = new LoadTimeLine( conceptName, Arrays.asList( new LoadPeriod( GanttDate.createFrom(new LocalDate(2009, 10, 5)), GanttDate.createFrom(new LocalDate(2009, 10, 11)), "100", "20", new LoadLevel(20))), null); }
@Test(expected = IllegalArgumentException.class) public void theLoadPeriodsMustNotOverlap() { LoadPeriod l1 = new LoadPeriod( GanttDate.createFrom(new LocalDate(2009, 10, 5)), GanttDate.createFrom(new LocalDate(2009, 10, 11)), "100", "20", new LoadLevel(20)); LoadPeriod l2 = new LoadPeriod( GanttDate.createFrom(new LocalDate(2009, 5, 3)), GanttDate.createFrom(new LocalDate(2009, 10, 10)), "100", "20", new LoadLevel(20)); new LoadTimeLine("bla", Arrays.asList(l1, l2), null); }
@Test public void aLoadTimelineSortsItsReceivedPeriods() { LoadPeriod l1 = new LoadPeriod( GanttDate.createFrom(new LocalDate(2009, 10, 5)), GanttDate.createFrom(new LocalDate(2009, 10, 11)), "100", "20", new LoadLevel(20)); LoadPeriod l2 = new LoadPeriod( GanttDate.createFrom(new LocalDate(2009, 5, 3)), GanttDate.createFrom(new LocalDate(2009, 6, 3)), "100", "20", new LoadLevel(20)); LoadTimeLine loadTimeLine = new LoadTimeLine("bla", Arrays.asList(l1, l2), null); List<LoadPeriod> loadPeriods = loadTimeLine.getLoadPeriods(); assertThat(loadPeriods.get(0), sameInstance(l2)); assertThat(loadPeriods.get(1), sameInstance(l1)); }