JSONExtractor { public Map<String, List<UsageStatistic>> getAllUserUsageBetween(String startDate, String endDate) throws IOException { Predicate<Long> predicate = filterDateIntervals(startDate, endDate); List<UsageStatistic> allStatistics = loadStatisticBetweenDate(startDate, endDate); List<UsageStatistic> usageStatisticList = allStatistics.stream().filter( p -> predicate.test(p.getFinishTime())).collect(Collectors.toList()); ConcurrentHashMap<String, List<UsageStatistic>> groupUserUsageStatistic = new ConcurrentHashMap<>(); usageStatisticList.forEach(p -> groupUserUsageStatistic.computeIfAbsent(p.getUser(), stringKey -> filterUser(stringKey, usageStatisticList) )); return groupUserUsageStatistic; }  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 testAllUserUsageBetween() throws Exception { Map<String, List<UsageStatistic>> allUsersStartEndDateStatistic = jsonExtractor.getAllUserUsageBetween( "2017-01-01", "2017-01-30"); List<UsageStatistic> usageStatisticList = allUsersStartEndDateStatistic.get("bla"); assertEquals(usageStatisticList.size(), 2); assertEquals(allUsersStartEndDateStatistic.size(), 11); }