### Question:
UsageDataManager { static Map<LocalDate, List<LocalDate>> filterDateAndGroup(final List<String> dateList, final LocalDate current, final Freq fileFrequency) { return dateList.stream() .map(s -> LocalDate.parse(s)) .filter(d -> !d.withDayOfMonth(1).equals(current.withDayOfMonth(1))) .collect(Collectors.groupingBy(d -> { switch (fileFrequency) { case weekly: return d.with(ChronoField.DAY_OF_WEEK, 1); case monthly: return d.withDayOfMonth(1); case yearly: return d.withDayOfYear(1); default: } return d; })); } private  UsageDataManager(); static UsageDataManager get(); JSONObject collect(final Map<String, Object> parameters); Path getUsageRepositoryPath(); String getAutoRefreshInterval(); List<File> getCollectorFiles(); List<String> getDateOfCollectorFiles(); void saveToRepository();  }### Answer:
@Test public void test_filterDateAndGroup_weekly() { final Map<LocalDate, List<LocalDate>> group = UsageDataManager.filterDateAndGroup(dateList, now, Freq.weekly); Assert.assertEquals(24, group.size()); testLeftGroup(group); }
@Test public void test_filterDateAndGroup_monthly() { final Map<LocalDate, List<LocalDate>> group = UsageDataManager.filterDateAndGroup(dateList, now, Freq.monthly); Assert.assertEquals(5, group.size()); testLeftGroup(group); }
@Test public void test_filterDateAndGroup_yearly() { final Map<LocalDate, List<LocalDate>> group = UsageDataManager.filterDateAndGroup(dateList, now, Freq.yearly); Assert.assertEquals(2, group.size()); testLeftGroup(group); }