@Test public void should_rewind_to_beginning_of_month() { Calendar calendar = Calendar.getInstance(); calendar.set(2015, 10, 2); VisibleMonths months = CalendarDataFactory.getInstance(Locale.GERMANY).create(calendar.getTime(), SIX_ROWS); assertThat(months.getLastMonth().size()).isEqualTo(6); assertThat(months.getCurrentMonth().size()).isEqualTo(30); assertThat(months.getNextMonth().size()).isEqualTo(6); }
@Override public VisibleMonths create(Date month, int rows) { Calendar calendar = setToFirstDayOf(month); List<Day> lastMonth = calculateLastMonth(calendar); List<Day> currentMonth = calculateCurrentMonth(calendar); List<Day> nextMonth = calculateNextMonth(rows, lastMonth, currentMonth); List<String> dayNames = getDayNames(lastMonth, currentMonth); return new VisibleMonths(new VisibleMonth(lastMonth), new VisibleMonth(currentMonth), new VisibleMonth(nextMonth), dayNames); }
CalendarDataFactoryImpl extends CalendarDataFactory { @Override public VisibleMonths create(Date month, int rows) { Calendar calendar = setToFirstDayOf(month); List<Day> lastMonth = calculateLastMonth(calendar); List<Day> currentMonth = calculateCurrentMonth(calendar); List<Day> nextMonth = calculateNextMonth(rows, lastMonth, currentMonth); List<String> dayNames = getDayNames(lastMonth, currentMonth); return new VisibleMonths(new VisibleMonth(lastMonth), new VisibleMonth(currentMonth), new VisibleMonth(nextMonth), dayNames); } }
CalendarDataFactoryImpl extends CalendarDataFactory { @Override public VisibleMonths create(Date month, int rows) { Calendar calendar = setToFirstDayOf(month); List<Day> lastMonth = calculateLastMonth(calendar); List<Day> currentMonth = calculateCurrentMonth(calendar); List<Day> nextMonth = calculateNextMonth(rows, lastMonth, currentMonth); List<String> dayNames = getDayNames(lastMonth, currentMonth); return new VisibleMonths(new VisibleMonth(lastMonth), new VisibleMonth(currentMonth), new VisibleMonth(nextMonth), dayNames); } CalendarDataFactoryImpl(Locale locale); }
CalendarDataFactoryImpl extends CalendarDataFactory { @Override public VisibleMonths create(Date month, int rows) { Calendar calendar = setToFirstDayOf(month); List<Day> lastMonth = calculateLastMonth(calendar); List<Day> currentMonth = calculateCurrentMonth(calendar); List<Day> nextMonth = calculateNextMonth(rows, lastMonth, currentMonth); List<String> dayNames = getDayNames(lastMonth, currentMonth); return new VisibleMonths(new VisibleMonth(lastMonth), new VisibleMonth(currentMonth), new VisibleMonth(nextMonth), dayNames); } CalendarDataFactoryImpl(Locale locale); @Override VisibleMonths create(Date month, int rows); }
CalendarDataFactoryImpl extends CalendarDataFactory { @Override public VisibleMonths create(Date month, int rows) { Calendar calendar = setToFirstDayOf(month); List<Day> lastMonth = calculateLastMonth(calendar); List<Day> currentMonth = calculateCurrentMonth(calendar); List<Day> nextMonth = calculateNextMonth(rows, lastMonth, currentMonth); List<String> dayNames = getDayNames(lastMonth, currentMonth); return new VisibleMonths(new VisibleMonth(lastMonth), new VisibleMonth(currentMonth), new VisibleMonth(nextMonth), dayNames); } CalendarDataFactoryImpl(Locale locale); @Override VisibleMonths create(Date month, int rows);  }