CalendarBusinessDateUtils { public static LocalDate nextGoodBusinessDate(final LocalDate startingDate, final Calendar calendar) { LocalDate currentDate = startingDate; while (!calendar.isWorkingDay(currentDate)) { currentDate = currentDate.plusDays(1); } return currentDate; }  static LocalDate nextGoodBusinessDate(final LocalDate startingDate, final Calendar calendar); static LocalDate nextNonGoodBusinessDate(final LocalDate startingDate, final Calendar calendar); static LocalDate nthGoodBusinessDate(final LocalDate startingDate, final Calendar calendar, final int numberDate); static LocalDate nthNonGoodBusinessDate(final LocalDate startingDate, final Calendar calendar, final int numberDate);  }
@Test public void nextGoodBusinessDate() { LocalDate startDate = LocalDate.of(2013, 12, 4); LocalDate nextGoodComputed = CalendarBusinessDateUtils.nextGoodBusinessDate(startDate, ECB); assertEquals("CalendarBusinessDateUtils: nextGoodBusinessDate", startDate, nextGoodComputed); LocalDate startDate2 = LocalDate.of(2013, 12, 11); LocalDate nextGoodComputed2 = CalendarBusinessDateUtils.nextGoodBusinessDate(startDate2, ECB); LocalDate nextGoodExpected2 = startDate2.plusDays(1); assertEquals("CalendarBusinessDateUtils: nextGoodBusinessDate", nextGoodExpected2, nextGoodComputed2); }