Fix issue with nested classes not handling exclude filters #35255
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 likecom.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 iscom.foo.SampleTest
. There is an edge case wherecom.foo.SampleTest
could match on a class namedfoo
in thecom
package with a method namedSampleTest
, 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