ReportGenerator { String generateJsonAllUserJobSummary(Map<String, List<UsageStatistic>> allUserStatisticsMap) { List<Map<String, String>> multiJobJsonContentsPerUserMap = new ArrayList<>(); allUserStatisticsMap.forEach((key, usageStatisticsList) -> { Map<String, String> multiJobJsonContentsPerUser = getMultiJobJsonContents(usageStatisticsList); multiJobJsonContentsPerUserMap.add(multiJobJsonContentsPerUser); }); Gson gson = new GsonBuilder().setPrettyPrinting().create(); return gson.toJson(multiJobJsonContentsPerUserMap); }    }
@Test public void testGenerateAllUserJobSummary() throws Exception { reportGenerator = new ReportGenerator(); Map<String, List<UsageStatistic>> allUserStatistic = jsonExtractor.getAllUserUsageStatistic("2017-01-10"); String jsonAllUserJobSummary = reportGenerator.generateJsonAllUserJobSummary(allUserStatistic); assertNotNull(jsonAllUserJobSummary); }
@Test public void testGenerateAllUserJobSummaryBetween() throws Exception { reportGenerator = new ReportGenerator(); Map<String, List<UsageStatistic>> allUserStatistic = jsonExtractor.getAllUserUsageBetween("2017-01-01", "2017-01-30"); String jsonAllUserJobSummary = reportGenerator.generateJsonAllUserJobSummary(allUserStatistic); assertNotNull(jsonAllUserJobSummary); }