Skip to content

[java] PMD requires public modifier on JUnit 5 test #428

@TimvdLippe

Description

@TimvdLippe

Rule Set:
TestClassWithoutTestCases

Description:
In Junit5 tests, tests do not require a public modifier any longer. However, PMD reports (without the modifier) that there are no test cases.

Code Sample demonstrating the issue:

import org.junit.jupiter.api.Test;

class JUnit5Test {
  @Test
  void myTest() {
  }
}

Adding public to the test removes the error.

Running PMD through: Maven

Metadata

Metadata

Assignees

Labels

a:bugPMD crashes or fails to analyse a file.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions