### Question:
MonthYearEndDateCalculator { public LocalDate calculateEndDate(int endYear, int endMonth) { LocalDate today = new LocalDate(); if (today.getMonthOfYear() == endMonth && today.getYear() == endYear) { return today; } return new LocalDate(endYear, endMonth, 1).dayOfMonth().withMaximumValue(); }  LocalDate calculateEndDate(int endYear, int endMonth);  }### Answer:
@Test public void calculateEndDate_TODAY() { LocalDate today = new LocalDate(); LocalDate calculatedDate = calculator.calculateEndDate(today.getYear(), today.getMonthOfYear()); assertEquals(today, calculatedDate); }
@Test public void calculateEndDate_NOT_TODAY() { LocalDate calculatedDate = calculator.calculateEndDate(2011, 11); assertEquals(new LocalDate(2011, 11, 30), calculatedDate); }