LocalDate start = new LocalDate().plusDays(1);
givenStretchAsChild(start, new BigDecimal(0.5));
LocalDate middleEnd = start.plusDays(2);
givenStretchAsChild(middleEnd, new BigDecimal(0.8));
givenStretchAsChild(middleEnd.plusDays(3), new BigDecimal(1));
Interval first = stretchesFunction.getIntervalsDefinedByStreches().get(
1);
Interval middle = stretchesFunction.getIntervalsDefinedByStreches()
.get(2);
Interval last = stretchesFunction.getIntervalsDefinedByStreches()
.get(3);
assertThat(first.getLoadProportion(), equalTo(new BigDecimal(0.5)
.setScale(2)));
assertThat(middle.getLoadProportion(), equalTo(new BigDecimal(0.3)
.setScale(2, RoundingMode.HALF_EVEN)));
assertThat(last.getLoadProportion(), equalTo(new BigDecimal(0.2)
.setScale(2, RoundingMode.HALF_EVEN)));
}