Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] Separate pattern for test classes in ClassNamingConventions rule for Java #2867

Closed
sabi0 opened this issue Oct 23, 2020 · 1 comment · Fixed by #4195
Closed

[java] Separate pattern for test classes in ClassNamingConventions rule for Java #2867

sabi0 opened this issue Oct 23, 2020 · 1 comment · Fixed by #4195
Labels
an:enhancement An improvement on existing features / rules
Milestone

Comments

@sabi0
Copy link

sabi0 commented Oct 23, 2020

Apex has testClassPattern - https://pmd.github.io/latest/pmd_rules_apex_codestyle.html#classnamingconventions

Java doesn't - https://pmd.github.io/latest/pmd_rules_java_codestyle.html#classnamingconventions

Having test classes names consistently end with "Test" is important to make sure they are correctly picked up by Maven Surefire plugin. I would say this is even more important than following other naming conventions.

@sabi0 sabi0 added the an:enhancement An improvement on existing features / rules label Oct 23, 2020
@oowekyala oowekyala changed the title Separate pattern for test classes in ClassNamingConventions rule for Java [java] Separate pattern for test classes in ClassNamingConventions rule for Java Nov 5, 2020
@adangel
Copy link
Member

adangel commented Oct 28, 2022

Note: Since PMD 6.51.0, the rule TestClassWithoutTestCases has a testClassPattern (#4162) - but here it's the other way around: we need to detect class, that don't follow the testClassPattern, but are probably tests (by checking the imports or the used annotations or the base class junit.TestCase)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
an:enhancement An improvement on existing features / rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants