-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add line comments for missed coverage in pit results.
- Loading branch information
Showing
6 changed files
with
133 additions
and
261 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/test/java/edu/hm/hafner/grading/CommentBuilderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package edu.hm.hafner.grading; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import edu.hm.hafner.coverage.registry.ParserRegistry.CoverageParserType; | ||
import edu.hm.hafner.util.FilteredLog; | ||
|
||
import static org.mockito.Mockito.*; | ||
|
||
class CommentBuilderTest { | ||
private static final String COVERAGE_CONFIGURATION = """ | ||
{ | ||
"coverage": [ | ||
{ | ||
"tools": [ | ||
{ | ||
"id": "pit", | ||
"name": "Mutation Coverage", | ||
"metric": "mutation", | ||
"pattern": "**/src/**/mutations-dashboard.xml" | ||
} | ||
], | ||
"name": "PIT", | ||
"maxScore": 100, | ||
"coveredPercentageImpact": 1, | ||
"missedPercentageImpact": -1 | ||
} | ||
] | ||
} | ||
"""; | ||
|
||
@Test | ||
void shouldRunComments() { | ||
var aggregation = new AggregatedScore(COVERAGE_CONFIGURATION, new FilteredLog("Test")); | ||
aggregation.gradeCoverage((tool, log) -> AggregatedScoreTest.readCoverageReport( | ||
"mutations-dashboard.xml", tool, CoverageParserType.PIT)); | ||
|
||
CommentBuilder builder = spy(CommentBuilder.class); | ||
|
||
builder.createAnnotations(aggregation); | ||
|
||
verify(builder, times(7)) | ||
.createComment(any(), anyString(), anyInt(), anyInt(), anyString(), anyString(), | ||
anyInt(), anyInt(), anyString(), anyString()); | ||
} | ||
} |
Oops, something went wrong.