JSONExtractor { LocalDate getFirstDayOfMonth(String dateTime) { return LocalDate.parse(dateTime).withDayOfMonth(DAY_OF_MONTH); }  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 firstDayOfMonth() { Assert.assertThat(jsonExtractor.getFirstDayOfMonth("2017-04-12").toString(), is("2017-04-01")); Assert.assertThat(jsonExtractor.getFirstDayOfMonth("2020-02-29").toString(), is("2020-02-01")); Assert.assertThat(jsonExtractor.getFirstDayOfMonth("2020-02-11").toString(), is("2020-02-01")); }
@Test public void testDateNonExist() { try { Assert.assertThat(jsonExtractor.getFirstDayOfMonth("2020/02/29T23:00").toString(), is("2020-02-01T00:00")); fail(); } catch (DateTimeParseException ignored) { } }