Issue #18027: Resolve pitest for formatter count in CheckstyleAntTask#18210
Conversation
| final File firstOutput = new File("target/ant_task_multi_formatter_1.txt"); | ||
| final File secondOutput = new File("target/ant_task_multi_formatter_2.txt"); | ||
| Files.deleteIfExists(firstOutput.toPath()); | ||
| Files.deleteIfExists(secondOutput.toPath()); |
There was a problem hiding this comment.
you probably meant temp files
try:
https://github.com/search?q=repo%3Acheckstyle%2Fcheckstyle%20%22Files.createTempFile%22&type=code
There was a problem hiding this comment.
Thank you for the suggestion. I tried using Files.createTempFile(temporaryFolder.toPath(), ...), but it fails the forbiddenapis check. I noticed MainTest.java uses this pattern, but it's excluded from forbiddenapis checks
Since CheckstyleAntTaskTest isn't excluded, I've used new File(temporaryFolder, "filename.txt") instead, which passes the check and works correctly. Happy to adjust if you prefer a different approach.
b8ea1b6 to
fe71838
Compare
fe71838 to
22f34aa
Compare
romani
left a comment
There was a problem hiding this comment.
Thanks a lot.
Next time please share violation error message, it will helps to confirm it.
|
Sure will keep in mind from the next time. |
Issue #18027:
Added test to kill mutant in CheckstyleAntTask.getListeners()
This PR adds a test case to kill a mutant that removes the call to formatters.size() in CheckstyleAntTask.getListeners() method.
Test Implementation:
Helper Method: