Skip to content

Conversation

@marcphilipp
Copy link
Member

Prior to this commit, when the test super class wss declared in another
package and declared a package-private test method with the same
signature as the subclass, the method from the subclass was silently
ignored. With the changes in this commit, both test methods are
executed, albeit with the same display name.

Fixes #5098.


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

Prior to this commit, when the test super class wss declared in another
package and declared a package-private test method with the same
signature as the subclass, the method from the subclass was silently
ignored. With the changes in this commit, both test methods are
executed, albeit with the same display name.

Fixes #5098.
@marcphilipp marcphilipp self-assigned this Oct 27, 2025
Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed 31128d6 to make the build green. But I've got some reservations about the way I've done so. For a lack of a better word, I would expect a symmetry of concerns between the unique id segment of a method and the method selector. Currently that symmetry is broken.

@marcphilipp
Copy link
Member Author

I've pushed 31128d6 to make the build green. But I've got some reservations about the way I've done so. For a lack of a better word, I would expect a symmetry of concerns between the unique id segment of a method and the method selector. Currently that symmetry is broken.

Thanks! I have similar reservations. Therefore, I've pushed two commits that solve the issue by introducing a Jupiter-specific, internal DeclaredMethodSelector.

@mpkorstanje WDYT?

Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks much neater!

We are still left with an adjacent issue that it is not possible to select all method based tests in a class with a collection of method selectors.

I.e. I would expect that while using the EngineDiscoveryRequestResolver I should be able to produce the same test plan by using either one class selector, or a collection of method selectors. Because the MethodSelector equals implementation lacks fidelity that isn't possible yet.

But I think we can fix that on a separate PR.

@marcphilipp
Copy link
Member Author

I would expect that while using the EngineDiscoveryRequestResolver I should be able to produce the same test plan by using either one class selector, or a collection of method selectors. Because the MethodSelector equals implementation lacks fidelity that isn't possible yet.

I agree but the scenario here is truly an edge case and I think we can postpone tackling the adjacent issue. When we do, we also need to think about NestedMethodSelector.

@marcphilipp marcphilipp merged commit 1866c0c into main Oct 29, 2025
16 checks passed
@marcphilipp marcphilipp deleted the marc/5098-package-private-hidden-methods branch October 29, 2025 16:14
@mpkorstanje
Copy link
Contributor

I agree but the scenario here is truly an edge case and I think we can postpone tackling the adjacent issue. When we do, we also need to think about NestedMethodSelector.

And MethodSource apparently 😄

marcphilipp added a commit that referenced this pull request Oct 30, 2025
Prior to this commit, when the test super class wss declared in another
package and declared a package-private test method with the same
signature as the subclass, the method from the subclass was silently
ignored. With the changes in this commit, both test methods are
executed, albeit with the same display name.

Fixes #5098.
marcphilipp added a commit that referenced this pull request Oct 30, 2025
Prior to this commit, when the test super class wss declared in another
package and declared a package-private test method with the same
signature as the subclass, the method from the subclass was silently
ignored. With the changes in this commit, both test methods are
executed, albeit with the same display name.

Fixes #5098.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test method is silently skipped when parent class has same-named package-private test method

3 participants