Skip to content

Fix inverted filter predicate in ForkStarter#readTestClassNames - #3453

Merged
olamy merged 2 commits into
apache:masterfrom
slachiewicz:fix/surefire-forkstarter-filter
Sep 6, 2026
Merged

Fix inverted filter predicate in ForkStarter#readTestClassNames#3453
olamy merged 2 commits into
apache:masterfrom
slachiewicz:fix/surefire-forkstarter-filter

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

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.

ForkStarter#readTestClassNames used String::isEmpty instead of !isEmpty(),
causing discovered test classes to be filtered out instead of retained
when running multi-fork or toolchain configurations.
@olamy olamy added this to the 3.6.1 milestone Sep 1, 2026
@olamy olamy added the bug Something isn't working label Sep 1, 2026
@slachiewicz
slachiewicz requested a review from olamy September 2, 2026 00:06
Signed-off-by: Olivier Lamy <olamy@apache.org>
@olamy olamy mentioned this pull request Sep 6, 2026
6 tasks
@olamy
olamy merged commit 0b4656c into apache:master Sep 6, 2026
14 checks passed
@olamy olamy assigned slachiewicz and unassigned olamy Sep 6, 2026
@slachiewicz
slachiewicz deleted the fix/surefire-forkstarter-filter branch September 6, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants