GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] CommentDefaultAccessModifier is triggered in JUnit5 test class · Issue #3859 · pmd/pmd

[java] CommentDefaultAccessModifier is triggered in JUnit5 test class #3859

New issue
Copy link
New issue
Copy link
Closed
#4137
Closed
[java] CommentDefaultAccessModifier is triggered in JUnit5 test class#3859
#4137
Copy link
Labels
a:false-positivePMD flags a piece of code that is not problematicgood first issueA great starting point for new contributors
Milestone
6.50.0

Description

@koalalam
koalalam
opened on Mar 18, 2022
Issue body actions

Affects PMD Version:

6.43.0

Rule:

JUnit5TestShouldBePackagePrivate
CommentDefaultAccessModifier

Description:

These 2 rules conflict with each other in JUnit5 test cases

Code Sample demonstrating the issue:

import org.junit.jupiter.api.Test;

class SomeTest {

  @Test
  void test() {
    // run some test
  }
}

Expected outcome:

CommentDefaultAccessModifier is not triggered in JUnit5 test class

PMD reports a violation at line ..., but that's wrong. That's a false positive.

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]

Gradle

Activity

  1. koalalam
    added
    a:false-positivePMD flags a piece of code that is not problematic
    on Mar 18, 2022
  2. koalalam commented on May 3, 2022

    @koalalam
    koalalam
    on May 3, 2022
    Author
    More actions

    Any update on this?

    This another rule DefaultPackage which is depreciated seems to handle JUnit5 correclty.

  3. adangel
    changed the title [-]CommentDefaultAccessModifier is triggered in JUnit5 test class[/-] [+][java] CommentDefaultAccessModifier is triggered in JUnit5 test class[/+] on May 3, 2022
  4. adangel
    added
    good first issueA great starting point for new contributors
    on May 3, 2022
  5. lfalcantar commented on Sep 28, 2022

    @lfalcantar
    lfalcantar
    on Sep 28, 2022
    Contributor
    More actions

    I have a solution similar to the DefaultPackage, where the code will check if the method is annotated with a junit5 and exclude the error from the violations. let me know what you think @adangel

  6. adangel
    added a commit that references this issue on Sep 29, 2022

    [doc] Update release notes (pmd#3859, pmd#4137)

    c9dfbff
  7. adangel
    added this to the 6.50.0 milestone on Sep 29, 2022
  8. adangel
    closed this as completedin #4137on Sep 29, 2022
  9. adangel
    added a commit that references this issue on Jan 10, 2023

    [java] CommentDefaultAccessModifier - extend test case for junit5

    11a33a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematicgood first issueA great starting point for new contributors

    Type

    No type

    Projects

    No projects

      Milestone

      • 6.50.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.