JSONExtractor { public List<UsageStatistic> getSingleUserUsageInYearMonth(String user, String year, String month) throws IOException, DatabaseFileNotFoundException { Predicate<FilterUserTimeInterval> yearMonthPredicate = FilterUserTimeInterval::filterMonth; return getSingleUserDate(yearMonthPredicate, user, year, month, INIT_FIRST_DAY); }  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 testUSerStatisticInYearMonth() throws Exception { JSONExtractor jsonExtractor = new JSONExtractor(); List<UsageStatistic> usageStatisticList = jsonExtractor.getSingleUserUsageInYearMonth("thomas", "2017", "01"); assertEquals(usageStatisticList.size(), 626); UsageStatistic usageStatistic = usageStatisticList.get(0); assertThat(usageStatistic.getJobId(), equalTo("job_1481485063251_18142")); assertThat(usageStatistic.getUser(), equalTo("thomas")); assertThat(usageStatistic.getQueue(), equalTo("high")); assertThat(usageStatistic.getStartTime(), equalTo(1484141759185L)); assertThat(usageStatistic.getFinishTime(), equalTo(1484142199965L)); assertThat(usageStatistic.getMapsCompleted(), equalTo(113)); assertThat(usageStatistic.getReducesCompleted(), equalTo(0)); assertThat(usageStatistic.getState(), equalTo("FAILED")); assertThat(usageStatistic.getInputPath(), equalTo("hdfs: assertThat(usageStatistic.getFileBytesRead(), equalTo(0L)); assertThat(usageStatistic.getFileBytesWritten(), equalTo(37940789L)); assertThat(usageStatistic.getHdfsBytesRead(), equalTo(37483768696L)); assertThat(usageStatistic.getHdfsBytesWritten(), equalTo(0L)); assertThat(usageStatistic.getvCoresMillisTotal(), equalTo(0L)); assertThat(usageStatistic.getMbMillisMapTotal(), equalTo(0L)); assertThat(usageStatistic.getCpuMilliseconds(), equalTo(6757140L)); }