use of de.avanux.smartapplianceenabler.schedule.ConsecutiveDaysTimeframe in project SmartApplianceEnabler by camueller.
the class ConsecutiveDaysTimeframeTest method getIntervals_AcrossWeeks_AfterIntervalEnd.
@Test
public void getIntervals_AcrossWeeks_AfterIntervalEnd() {
TimeOfDayOfWeek startTimeOfDayOfWeek = new TimeOfDayOfWeek(6, 15, 0, 0);
TimeOfDayOfWeek endTimeOfDayOfWeek = new TimeOfDayOfWeek(1, 20, 0, 0);
ConsecutiveDaysTimeframe timeRange = new ConsecutiveDaysTimeframe(startTimeOfDayOfWeek, endTimeOfDayOfWeek);
LocalDateTime now = toDayOfWeek(1, 21, 0, 0);
List<TimeframeInterval> intervals = timeRange.getIntervals(now);
Assert.assertEquals(1, intervals.size());
LocalDateTime start = startTimeOfDayOfWeek.toNextOccurrence(now);
assertDateTime(start, intervals.get(0).getInterval().getStart().toLocalDateTime());
assertDateTime(endTimeOfDayOfWeek.toNextOccurrence(start), intervals.get(0).getInterval().getEnd().toLocalDateTime());
}
Aggregations