JSONExtractor { public List<UsageStatistic> getSingleUserUsageInYear(String user, String year) throws IOException { String beginYrDate = String.format("%s-01-01", year); String endYrDate = String.format("%s-12-31", year); return getSingleUserUsageBetween(user, beginYrDate, endYrDate); }  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 testUSerStatisticInYear() throws Exception { List<UsageStatistic> usageStatisticList = jsonExtractor.getSingleUserUsageInYear("jessica", "2017"); assertEquals(usageStatisticList.size(), 4); UsageStatistic usageStatistic = usageStatisticList.get(0); assertThat(usageStatistic.getJobId(), equalTo("job_1481485063251_20533")); assertThat(usageStatistic.getUser(), equalTo("jessica")); assertThat(usageStatistic.getQueue(), equalTo("default")); assertThat(usageStatistic.getStartTime(), equalTo(1484301451312L)); assertThat(usageStatistic.getFinishTime(), equalTo(1484303865778L)); assertThat(usageStatistic.getMapsCompleted(), equalTo(7)); assertThat(usageStatistic.getReducesCompleted(), equalTo(0)); assertThat(usageStatistic.getState(), equalTo("SUCCEEDED")); assertThat(usageStatistic.getInputPath(), equalTo("hdfs: assertThat(usageStatistic.getFileBytesRead(), equalTo(0L)); assertThat(usageStatistic.getFileBytesWritten(), equalTo(2100959L)); assertThat(usageStatistic.getHdfsBytesRead(), equalTo(6972918194L)); assertThat(usageStatistic.getHdfsBytesWritten(), equalTo(1776409134L)); assertThat(usageStatistic.getvCoresMillisTotal(), equalTo(3255256L)); assertThat(usageStatistic.getMbMillisMapTotal(), equalTo(8333455360L)); assertThat(usageStatistic.getCpuMilliseconds(), equalTo(357650L)); }