ReportMonth { public LocalDate endDateOfReportingMonthGivenStartDate(LocalDate startDate) { return startDate.plusMonths(1).minusDays(1); }  Date startDateOfReportingYear(); int reportingYear(); LocalDate startDateOfNextReportingMonth(LocalDate date); LocalDate endDateOfReportingMonthGivenStartDate(LocalDate startDate); LocalDate startOfCurrentReportMonth(LocalDate date); LocalDate endOfCurrentReportMonth(LocalDate date); boolean isDateWithinCurrentReportMonth(LocalDate lastReportedDate); int reportingMonth(LocalDate date); int reportingYear(LocalDate date); boolean areDatesBelongToSameReportingMonth(LocalDate date, LocalDate anotherDate);  }
@Test public void shouldCalculateEndDateOfReportMonth() throws Exception { assertEquals(LocalDate.parse("2012-02-25"), reportMonth.endDateOfReportingMonthGivenStartDate(LocalDate.parse("2012-01-26"))); assertEquals(LocalDate.parse("2012-12-25"), reportMonth.endDateOfReportingMonthGivenStartDate(LocalDate.parse("2012-11-26"))); assertEquals(LocalDate.parse("2013-01-25"), reportMonth.endDateOfReportingMonthGivenStartDate(LocalDate.parse("2012-12-26"))); }