Skip to content

[java] Fix #3288: New rule JUnit5TestNoPrivateModifierRule#6604

Merged
adangel merged 13 commits into
pmd:mainfrom
UncleOwen:issue-3288-new-rule-JUnitTestWrongModifier
May 14, 2026
Merged

[java] Fix #3288: New rule JUnit5TestNoPrivateModifierRule#6604
adangel merged 13 commits into
pmd:mainfrom
UncleOwen:issue-3288-new-rule-JUnitTestWrongModifier

Conversation

@UncleOwen
Copy link
Copy Markdown
Member

Describe the PR

Flip side of JUnit5TestShouldBePackagePrivate - the existing rule checks that our junit5 tests aren't too visible, this new rule checks that they are visible enough. I didn't implement the (optional) JUnit4 part of the rule. Didn't feel like spending time on it, JUnit5 has been out for over 8 years.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 18, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 7 complexity · 0 duplication

Metric Results
Complexity 7
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes. Give us feedback

@pmd-actions-helper
Copy link
Copy Markdown
Contributor

pmd-actions-helper Bot commented Apr 18, 2026

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(comment created at 2026-05-08 15:36:43+00:00 for 388a6bd)

@UncleOwen UncleOwen changed the title [java] Fix #3288: new rule JUnit5TestWrongModifier [java] Fix #3288: new rule JUnit5TestNoPrivateModifierRule Apr 18, 2026
@UncleOwen UncleOwen force-pushed the issue-3288-new-rule-JUnitTestWrongModifier branch from 026eb3d to 3050e34 Compare April 22, 2026 15:53
@UncleOwen UncleOwen force-pushed the issue-3288-new-rule-JUnitTestWrongModifier branch from 89dbe8e to a806a83 Compare April 24, 2026 14:30
@UncleOwen UncleOwen marked this pull request as draft April 26, 2026 09:52
@UncleOwen UncleOwen force-pushed the issue-3288-new-rule-JUnitTestWrongModifier branch from 77a57c9 to efa374e Compare April 26, 2026 10:32
The round trip Node -> JTypeMirror -> Node doesn't work, if you end up
in another source file.
@UncleOwen UncleOwen force-pushed the issue-3288-new-rule-JUnitTestWrongModifier branch from efa374e to 571ecd8 Compare April 26, 2026 10:35
@UncleOwen UncleOwen marked this pull request as ready for review April 30, 2026 13:28
@adangel adangel changed the title [java] Fix #3288: new rule JUnit5TestNoPrivateModifierRule [java] Fix #3288: New rule JUnit5TestNoPrivateModifierRule May 7, 2026
@adangel adangel added the a:new-rule Proposal to add a new built-in rule label May 7, 2026
@adangel adangel added this to the 7.25.0 milestone May 7, 2026
Copy link
Copy Markdown
Member

@adangel adangel left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

Please have a look at my comments.

Comment thread pmd-java/src/main/resources/category/java/errorprone.xml Outdated
@adangel adangel added the needs:user-input Maintainers are waiting for feedback from author label May 7, 2026
@adangel adangel removed the needs:user-input Maintainers are waiting for feedback from author label May 14, 2026
Copy link
Copy Markdown
Member

@adangel adangel left a comment

Choose a reason for hiding this comment

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

Thanks!

adangel added a commit that referenced this pull request May 14, 2026
@adangel adangel merged commit aaaed69 into pmd:main May 14, 2026
13 checks passed
@UncleOwen UncleOwen deleted the issue-3288-new-rule-JUnitTestWrongModifier branch May 14, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a:new-rule Proposal to add a new built-in rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[java] New Rule: JUnit5TestNoPrivateModifier

2 participants