edu.hm.hafner.grading.FileSystemTestReportFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of autograding-model Show documentation
Show all versions of autograding-model Show documentation
This module autogrades Java projects based on a configurable set of metrics.
The newest version!
package edu.hm.hafner.grading;
import org.apache.commons.lang3.StringUtils;
import edu.hm.hafner.coverage.Metric;
import edu.hm.hafner.coverage.Node;
import edu.hm.hafner.coverage.TestCount;
import edu.hm.hafner.grading.AggregatedScore.TestReportFactory;
import edu.hm.hafner.util.FilteredLog;
/**
* Reads test reports of a specific type from the file system and creates an aggregated report.
*
* @author Ullrich Hafner
*/
public final class FileSystemTestReportFactory implements TestReportFactory {
@Override
public Node create(final ToolConfiguration tool, final FilteredLog log) {
var name = StringUtils.defaultIfBlank(tool.getName(), "Tests");
var delegate = new FileSystemCoverageReportFactory();
var report = delegate.create(new ToolConfiguration("junit", name, tool.getPattern(), "", Metric.TESTS.name()), log);
log.logInfo("-> %s Total: %s tests",
name, report.getValue(Metric.TESTS).orElse(new TestCount(0)));
return report;
}
}