You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "slachiewicz (via GitHub)" <gi...@apache.org> on 2026/09/01 18:54:38 UTC
[PR] Fix inverted filter predicate in ForkStarter#readTestClassNames [maven-surefire]
slachiewicz opened a new pull request, #3453:
URL: https://github.com/apache/maven-surefire/pull/3453
### Description
In `ForkStarter#readTestClassNames`, `Files.readAllLines` was filtered using `String::isEmpty`, which inadvertently discarded all discovered test class names and retained only blank lines.
When using toolchains or `forkCount > 1` / `reuseForks=false`, this resulted in zero tests being scheduled and the build passing silently without running any test classes.
### Changes
- Changed `.filter(String::isEmpty)` to `.filter(line -> !line.isEmpty())` in `ForkStarter#readTestClassNames`.
- Added a warning if the discovery file contains no test classes.
- Added unit test `readTestClassNamesShouldKeepDiscoveredClassesAndDropBlankLines` in `ForkStarterTest`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix inverted filter predicate in ForkStarter#readTestClassNames [maven-surefire]
Posted by "XN137 (via GitHub)" <gi...@apache.org>.
XN137 commented on PR #3453:
URL: https://github.com/apache/maven-surefire/pull/3453#issuecomment-5600063764
thanks for the fix, but wondering: arent we missing an integration that covers this (common?!) scenario?
or were existing ones silently failing by not running anything?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix inverted filter predicate in ForkStarter#readTestClassNames [maven-surefire]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on code in PR #3453:
URL: https://github.com/apache/maven-surefire/pull/3453#discussion_r3914339424
##########
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java:
##########
@@ -868,7 +873,7 @@ private static List<String> readTestClassNames(File discoveryFile) throws Surefi
try {
return Files.readAllLines(discoveryFile.toPath(), UTF_8).stream()
.map(String::trim)
- .filter(String::isEmpty)
+ .filter(line -> !line.isEmpty())
Review Comment:
This is exactly the problem with lambdas and filters. It is completely opaque whether you're filtering values in or out. Even if this code is now correct, it would be much clearer to rewrite the operation using a simple, ordinary loop that leaves no room for doubt about what it's doing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix inverted filter predicate in ForkStarter#readTestClassNames [maven-surefire]
Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy merged PR #3453:
URL: https://github.com/apache/maven-surefire/pull/3453
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix inverted filter predicate in ForkStarter#readTestClassNames [maven-surefire]
Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy commented on PR #3453:
URL: https://github.com/apache/maven-surefire/pull/3453#issuecomment-5600245159
> thanks for the fix, but wondering: arent we missing an integration that covers this (common?!) scenario? or were existing ones silently failing by not running anything?
correct there was no automatic test for this I added one with this https://github.com/apache/maven-surefire/pull/3458
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org