Skip to content

Commit

Permalink
Update coverage API with ´fileName´.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Mar 8, 2024
1 parent 20d8bc2 commit a3ae6af
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Node create(final ToolConfiguration tool, final FilteredLog log) {

var nodes = new ArrayList<Node>();
for (Path file : REPORT_FINDER.find(tool, log)) {
var node = parser.parse(new FileReaderFactory(file).create(), log);
var node = parser.parse(new FileReaderFactory(file).create(), file.toString(), log);
log.logInfo("- %s: %s", PATH_UTIL.getRelativePath(file), extractMetric(tool, node));
nodes.add(node);
}
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/edu/hm/hafner/grading/AggregatedScoreTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,10 @@ void shouldGradeCoverageReport() {

private Node readReport(final ToolConfiguration tool) {
var parser = new ParserRegistry().get(CoverageParserType.JACOCO, ProcessingMode.FAIL_FAST);
try (InputStream stream = createStream("jacoco.xml");
var fileName = "jacoco.xml";
try (InputStream stream = createStream(fileName);
Reader reader = new InputStreamReader(Objects.requireNonNull(stream), StandardCharsets.UTF_8)) {
var root = parser.parse(reader, new FilteredLog("Test"));
var root = parser.parse(reader, fileName, new FilteredLog("Test"));
var containerNode = new ModuleNode(tool.getDisplayName());
containerNode.addChild(root);
return containerNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void shouldCreateAggregation() {
score.gradeTests(new FileSystemTestReportFactory());

assertTestClasses(score.getTestScores().get(0).getReport().getAllClassNodes());
assertThat(log.getInfoMessages()).contains(
assertThat(log.getInfoMessages()).containsAnyOf(
"Searching for Unittests results matching file name pattern **/src/**/TEST*.xml",
"- src/test/resources/edu/hm/hafner/grading/TEST-Aufgabe3Test.xml: TESTS: 33",
"- src/test/resources/edu/hm/hafner/grading/TEST-edu.hm.hafner.grading.AutoGradingActionTest.xml: TESTS: 1",
Expand Down

0 comments on commit a3ae6af

Please sign in to comment.