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] TestClassWithoutTestCases reports wrong classes in a file · Issue #3624 · pmd/pmd

[java] TestClassWithoutTestCases reports wrong classes in a file #3624

New issue
Copy link
New issue
Copy link
Closed
#3615
Closed
[java] TestClassWithoutTestCases reports wrong classes in a file#3624
#3615
Copy link
Labels
a:false-positivePMD flags a piece of code that is not problematic
Milestone
6.41.0

Description

@adangel
adangel
opened on Nov 14, 2021
Issue body actions

Affects PMD Version: 6.40.0

Rule: TestClassWithoutTestCases

Description:

When a test class contains additional helper classes in the same compilation units, then these are reported as well, even if they are no test classes.

Code Sample demonstrating the issue:

import org.junit.Test;

public class MyTest {
    @Test
    public void myTest() {
    }
}

class Helper { }  // this is reported, but this is not a test class, so doesn't need test cases

Expected outcome:

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

Activity

  1. adangel
    added
    a:false-positivePMD flags a piece of code that is not problematic
    on Nov 14, 2021
  2. adangel
    added this to the 6.41.0 milestone on Nov 14, 2021
  3. adangel
    added a commit that references this issue on Nov 15, 2021

    [java] TestClassWithoutTestCases - add test for pmd#3624

    956077f
  4. adangel
    added a commit that references this issue on Nov 26, 2021

    Merge pull requets #3615 from adangel:java-rule-improvements-1

    2d76292
  5. adangel
    closed this as completedin #3615on Nov 26, 2021
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 problematic

    Type

    No type

    Projects

    No projects

      Milestone

      • 6.41.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.