return collectAndWriteRunStats(test, coverageData);
}
private TestRunCoverageStatistics collectAndWriteRunStats(
final URI test, final Map<String, Map<String, Long>> coverageDataForAllScripts) throws IOException {
final TestRunCoverageStatistics runStats = new TestRunCoverageStatistics(test);
runStats.setSortBy(config.getSortBy());
runStats.setOrder(config.getOrder());
final URI baseUri = config.getBaseUri();
for (final ScriptData data : getLocalBrowser().getScriptDataList()) {
final String sourceUri = data.getSourceUriAsString();
@SuppressWarnings("unchecked")
final Map<String, Long> coverageDataForScript = coverageDataForAllScripts.get(sourceUri);
final ScriptCoverageStatistics scriptCoverageStatistics = data.generateScriptCoverageStatistics(baseUri, coverageDataForScript);
runStats.add(scriptCoverageStatistics);
}
return runStats;
}