@Test public void calculateEndDate_NOT_TODAY() { LocalDate calculatedDate = calculator.calculateEndDate(2011, 11); assertEquals(new LocalDate(2011, 11, 30), calculatedDate); }
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(); }
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(); } }
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(); }  }
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); }
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);  }