JSONExtractor { Set<String> getDatesBetween(String start, String end) { LocalDateTime startOfDay = LocalDate.parse(start).atStartOfDay(); LocalDateTime endOfDay = LocalDate.parse(end).atStartOfDay(); long l = Duration.between(startOfDay, endOfDay).toDays(); Set<String> dates = new TreeSet<>(); for (int i = 0; i <= l; i++) { LocalDate localDate = startOfDay.plusDays(i).toLocalDate(); dates.add(localDate.toString()); } return dates; }  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 testDateBetween() { JSONExtractor jsonExtractor = new JSONExtractor(); Set<String> datesBetween = jsonExtractor.getDatesBetween("2017-01-01", "2017-01-05"); assertEquals(datesBetween.size(), 5); assertTrue(datesBetween.contains("2017-01-01")); assertTrue(datesBetween.contains("2017-01-02")); assertTrue(datesBetween.contains("2017-01-03")); assertTrue(datesBetween.contains("2017-01-04")); assertTrue(datesBetween.contains("2017-01-05")); }
@Test public void testDateNotBetween() { Set<String> datesBetween = jsonExtractor.getDatesBetween("2019-01-01", "2017-01-13"); assertEquals(datesBetween.size(), 0); }