JSONExtractor { public Map<String, List<UsageStatistic>> getAllDateUsageBetween(String startDate, String endDate) throws IOException { List<UsageStatistic> allStatistics = loadStatisticBetweenDate(startDate, endDate); Set<String> dates = getDatesBetween(startDate, endDate); Map<String, List<UsageStatistic>> usageWithDate = new HashMap<>(); dates.forEach(date -> { Predicate<Long> predicate = filterDateIntervals(date, date); List<UsageStatistic> usageStatisticList = allStatistics .stream() .filter(p -> predicate.test(p.getFinishTime())) .collect(Collectors.toList()); usageWithDate.put(date, usageStatisticList); }); return usageWithDate; }  List<UsageStatistic> loadStatisticOf(String date); Map<String, List<UsageStatistic>> getAllUserUsageStatistic(String date); List<UsageStatistic> getUsageStatisticsSince(String startDate); Map<String, List<UsageStatistic>> getAllUserUsageBetween(String startDate, String endDate); Map<String, List<UsageStatistic>> getAllDateUsageBetween(String startDate, String endDate); Map<String, List<UsageStatistic>> getAllQueueUsageBetween(String startDate, String endDate); UsageStatistic getSingleStatistic(String jobId, String date); List<UsageStatistic> getSingleUserStatistic(String userName, String date); List<UsageStatistic> getSingleUserUsageBetween(String user, String startDate, String endDate); List<UsageStatistic> getSingleUserUsageInYear(String user, String year); List<UsageStatistic> getSingleUserUsageInYearMonth(String user, String year, String month); List<UsageStatistic> getSingleUserUsageYearMonthDay(String user, String year, String month,
                                                               String day);  }
@Test public void testAllDateUsageBetween() throws Exception { Map<String, List<UsageStatistic>> allUsersStartEndDateStatistic = jsonExtractor.getAllDateUsageBetween( "2017-01-09", "2017-01-15"); assertEquals(allUsersStartEndDateStatistic.size(), 7); }