Skip to content

Conversation

ghale
Copy link
Member

@ghale ghale commented Oct 8, 2025

This fixes an issue where JUnit 5 nested classes were not being excluded properly because we would match on an included parent class and improperly determine that the excluded class should be included.

Note that this also fixes an underlying issue with the pattern matching when including/excluding a test class. Adding a classname like com.foo.SampleTest resulted in a pattern like com.foo.SampleTest.* which would never match on a classname (only on a method name). We now use a pattern without the wild card which means the pattern is com.foo.SampleTest. There is an edge case where com.foo.SampleTest could match on a class named foo in the com package with a method named SampleTest, but this seems exotic enough that it's not worth the additional complexity to handle it.

Fixes #31304

Reviewing cheatsheet

Before merging the PR, comments starting with

  • ❌ ❓must be fixed
  • 🤔 💅 should be fixed
  • 💭 may be fixed
  • 🎉 celebrate happy things

@ghale ghale added this to the 9.3.0 RC1 milestone Oct 8, 2025
@ghale ghale self-assigned this Oct 8, 2025
@ghale ghale added a:bug in:testing-junit5 junit platform vintage jupiter labels Oct 8, 2025
@ghale
Copy link
Member Author

ghale commented Oct 8, 2025

@bot-gradle test this

@bot-gradle

This comment has been minimized.

@bot-gradle
Copy link
Collaborator

The following builds have passed:

@ghale ghale marked this pull request as ready for review October 8, 2025 19:39
@ghale ghale requested review from a team as code owners October 8, 2025 19:39
@ghale ghale requested review from jvandort and tresat and removed request for jvandort October 8, 2025 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a:bug in:testing-junit5 junit platform vintage jupiter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

filter.excludeTest doesn't work for a JUnit5 nested test class inside another nested test class

2 participants