DateUtil { public static ArrayList<String> getCurrentWeeksDates(){ ArrayList<String> dates = new ArrayList<>(); LocalDate now = new LocalDate(); for (int day = DateTimeConstants.MONDAY; day <= DateTimeConstants.SUNDAY; day++){ LocalDate localDate = now.withDayOfWeek(day); dates.add(getFormattedDate(localDate, DATE_FORMAT)); } return dates; }  static String getCurrentDate(); static ArrayList<String> getCurrentWeeksDates(); static String currentMonthOfYear(); static String getDayName(String dateString); static final String DATE_FORMAT; }
@Test public void shouldReturnCurrentWeeksDatesFromMonToSun() throws Exception { LocalDate now = new LocalDate(); assertThat(now.withDayOfWeek(DateTimeConstants.MONDAY).toString(), is("2015-08-31")); assertThat(now.withDayOfWeek(DateTimeConstants.SUNDAY).toString(), is("2015-09-06")); ArrayList<String> currentWeeksDates = DateUtil.getCurrentWeeksDates(); assertThat(currentWeeksDates.size(), is(7)); assertThat(currentWeeksDates, hasItems( "31-08-2015", "01-09-2015", "02-09-2015", "03-09-2015", "04-09-2015", "05-09-2015", "06-09-2015") ); }