Skip to content

Commit

Permalink
[java] CommentDefaultAccessModifier: Fix ParameterizedTest annotation
Browse files Browse the repository at this point in the history
Fixes pmd#4645
  • Loading branch information
adangel committed Oct 6, 2023
1 parent 89c7da8 commit c071143
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions docs/pages/release_notes.md
Expand Up @@ -42,6 +42,8 @@ The remaining section describes the complete release notes for 7.0.0.
#### New and Noteworthy

#### Fixed issues
* java-codestyle
* [#4645](https://github.com/pmd/pmd/issues/4645): \[java] CommentDefaultAccessModifier - False Positive with JUnit5's ParameterizedTest

#### API Changes

Expand Down Expand Up @@ -558,6 +560,7 @@ Language specific fixes:
* [#4511](https://github.com/pmd/pmd/issues/4511): \[java] LocalVariableCouldBeFinal shouldn't report unused variables
* [#4512](https://github.com/pmd/pmd/issues/4512): \[java] MethodArgumentCouldBeFinal shouldn't report unused parameters
* [#4557](https://github.com/pmd/pmd/issues/4557): \[java] UnnecessaryImport FP with static imports of overloaded methods
* [#4645](https://github.com/pmd/pmd/issues/4645): \[java] CommentDefaultAccessModifier - False Positive with JUnit5's ParameterizedTest
* java-design
* [#1014](https://github.com/pmd/pmd/issues/1014): \[java] LawOfDemeter: False positive with lambda expression
* [#1605](https://github.com/pmd/pmd/issues/1605): \[java] LawOfDemeter: False positive for standard UTF-8 charset name
Expand Down
Expand Up @@ -52,16 +52,16 @@ public class CommentDefaultAccessModifierRule extends AbstractJavaRulechainRule
"com.google.common.annotations.VisibleForTesting",
"android.support.annotation.VisibleForTesting",
"co.elastic.clients.util.VisibleForTesting",
"org.junit.jupiter.api.Test",
"org.junit.jupiter.api.extension.RegisterExtension",
"org.junit.jupiter.api.ParameterizedTest",
"org.junit.jupiter.api.AfterAll",
"org.junit.jupiter.api.AfterEach",
"org.junit.jupiter.api.BeforeAll",
"org.junit.jupiter.api.BeforeEach",
"org.junit.jupiter.api.RepeatedTest",
"org.junit.jupiter.api.Test",
"org.junit.jupiter.api.TestFactory",
"org.junit.jupiter.api.TestTemplate",
"org.junit.jupiter.api.BeforeEach",
"org.junit.jupiter.api.BeforeAll",
"org.junit.jupiter.api.AfterEach",
"org.junit.jupiter.api.AfterAll",
"org.junit.jupiter.api.extension.RegisterExtension",
"org.junit.jupiter.params.ParameterizedTest",
"org.testng.annotations.Test",
"org.testng.annotations.AfterClass",
"org.testng.annotations.AfterGroups",
Expand Down
Expand Up @@ -454,16 +454,16 @@ public enum MyEnum {
</test-code>

<test-code>
<description>#3859 #4273 [java] CommentDefaultAccessModifier is triggered in JUnit5 method and it was conflicting with rule JUnit5TestShouldBePackagePrivate</description>
<description>#3859 #4273 #4645 [java] CommentDefaultAccessModifier is triggered in JUnit5 method and it was conflicting with rule JUnit5TestShouldBePackagePrivate</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.ParameterizedTest;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.provider.ValueSource;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
class SomeTest {
Expand Down

0 comments on commit c071143

Please sign in to comment.