ReportMonth { public boolean areDatesBelongToSameReportingMonth(LocalDate date, LocalDate anotherDate) { return !(date.isBefore(startOfCurrentReportMonth(anotherDate)) || date.isAfter(endOfCurrentReportMonth(anotherDate))); }  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 shouldCheckWhetherBothTheDatesAreWithinSameReportingMonth() { assertTrue(reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2013-01-26"), LocalDate.parse("2013-01-26"))); assertTrue(reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2013-02-01"), LocalDate.parse("2013-02-15"))); assertTrue(reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2013-02-01"), LocalDate.parse("2013-02-25"))); assertTrue(reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2013-02-25"), LocalDate.parse("2013-02-25"))); assertTrue(reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2012-12-26"), LocalDate.parse("2013-01-01"))); assertTrue(reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2012-12-26"), LocalDate.parse("2013-01-25"))); assertFalse(reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2013-01-25"), LocalDate.parse("2013-01-26"))); assertFalse(reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2013-01-26"), LocalDate.parse("2013-02-26"))); }