ReportMonth { public LocalDate startDateOfNextReportingMonth(LocalDate date) { if (date.getDayOfMonth() < REPORTING_MONTH_START_DAY) { return new LocalDate(date.getYear(), date.getMonthOfYear(), REPORTING_MONTH_START_DAY); } if (date.getMonthOfYear() == DECEMBER) { return new LocalDate(date.plusYears(1).getYear(), JANUARY, REPORTING_MONTH_START_DAY); } return new LocalDate(date.getYear(), date.plusMonths(1).getMonthOfYear(), REPORTING_MONTH_START_DAY); }  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 shouldCalculateStartOfNextReportMonth() throws Exception { assertEquals(LocalDate.parse("2012-01-26"), reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2012-01-01"))); assertEquals(LocalDate.parse("2012-02-26"), reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2012-01-26"))); assertEquals(LocalDate.parse("2012-02-26"), reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2012-01-27"))); assertEquals(LocalDate.parse("2011-12-26"), reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2011-11-28"))); assertEquals(LocalDate.parse("2011-12-26"), reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2011-12-25"))); assertEquals(LocalDate.parse("2012-01-26"), reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2011-12-26"))); assertEquals(LocalDate.parse("2012-01-26"), reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2011-12-27"))); }