CalendarBusinessDateUtils { public static LocalDate nthNonGoodBusinessDate(final LocalDate startingDate, final Calendar calendar, final int numberDate) { ArgumentChecker.isTrue(numberDate >= 1, "At least one roll date"); LocalDate nthDate = nextNonGoodBusinessDate(startingDate, calendar); for (int loopNumber = 1; loopNumber < numberDate; loopNumber++) { nthDate = nextNonGoodBusinessDate(nthDate.plusDays(1), calendar); } return nthDate; }  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 nthNonGoodBusinessDate() { LocalDate startDate = LocalDate.of(2013, 12, 4); LocalDate nextNonGood = CalendarBusinessDateUtils.nextNonGoodBusinessDate(startDate, ECB); LocalDate firstNonGoodComputed = CalendarBusinessDateUtils.nthNonGoodBusinessDate(startDate, ECB, 1); assertEquals("CalendarBusinessDateUtils: nthNonGoodBusinessDate", nextNonGood, firstNonGoodComputed); int number = 5; LocalDate nthNonGoodExpected = LocalDate.of(2014, 4, 9); LocalDate nthNonGoodComputed = CalendarBusinessDateUtils.nthNonGoodBusinessDate(startDate, ECB, number); assertEquals("CalendarBusinessDateUtils: nthNonGoodBusinessDate", nthNonGoodExpected, nthNonGoodComputed); }