@Test public void test2() { final ZonedDateTime startDate = DateUtils.getUTCDate(2000, 1, 1); final ZonedDateTime endDate = DateUtils.getUTCDate(2002, 2, 9); final int months = 25; final ZonedDateTime[] forward = CALCULATOR.getSchedule(startDate, endDate, false, true); assertEquals(forward.length, months); final ZonedDateTime firstDate = DateUtils.getUTCDate(2000, 1, 31); assertEquals(forward[0], firstDate); final ZonedDateTime lastDate = DateUtils.getUTCDate(2002, 1, 31); assertEquals(forward[months - 1], lastDate); ZonedDateTime d1; for (int i = 1; i < months; i++) { d1 = forward[i]; if (d1.getYear() == forward[i - 1].getYear()) { assertEquals(d1.getMonthValue() - forward[i - 1].getMonthValue(), 1); } else { assertEquals(d1.getMonthValue() - forward[i - 1].getMonthValue(), -11); } assertEquals(d1.getDayOfMonth(), d1.toLocalDate().lengthOfMonth()); } assertArrayEquals(CALCULATOR.getSchedule(startDate, endDate, true, false), forward); assertArrayEquals(CALCULATOR.getSchedule(startDate, endDate, true, true), forward); assertArrayEquals(CALCULATOR.getSchedule(startDate, endDate, false, false), forward); assertArrayEquals(CALCULATOR.getSchedule(startDate, endDate, false, true), forward); assertArrayEquals(CALCULATOR.getSchedule(startDate, endDate), forward); }