### Question:
XDateRangeUtils { public LocalDate generateEndDate(LocalDate startDate, Period period) { if (period.getUnit().equals(PeriodUnit.DAY)) { return startDate.plusDays(period.getValue()-1); } if (period.getUnit().equals(PeriodUnit.MONTH)) { return startDate.plusMonths(period.getValue()).minusDays(1); } if (period.getUnit().equals(PeriodUnit.YEAR)) { return startDate.plusYears(period.getValue()).minusDays(1); } throw new IllegalArgumentException("Period unit " + period.getUnit() + " not handled"); }  XDateRange getDateRange(XSettings xsettings); LocalDate generateEndDate(LocalDate startDate, Period period);  }### Answer:
@Test public void generateEndDate_DAY() { LocalDate startDate = new LocalDate(2011, 11, 11); LocalDate endDate = utils.generateEndDate(startDate, new Period(1, PeriodUnit.DAY)); assertEquals(new LocalDate(2011, 11, 11), endDate); }
@Test public void generateEndDate_MONTH() { LocalDate startDate = new LocalDate(2011, 11, 11); LocalDate endDate = utils.generateEndDate(startDate, new Period(1, PeriodUnit.MONTH)); assertEquals(new LocalDate(2011, 12, 10), endDate); }
@Test public void generateEndDate_YEAR() { LocalDate startDate = new LocalDate(2011, 11, 11); LocalDate endDate = utils.generateEndDate(startDate, new Period(1, PeriodUnit.YEAR)); assertEquals(new LocalDate(2012, 11, 10), endDate); }