Skip to content

[java] UnitTestShouldIncludeAssert: False positive with JUnitSoftAssertions Rule (JUnit 4)  #6681

@UncleOwen

Description

@UncleOwen

Affects PMD Version: 7.24.0

Description:

This test is broken: JUnit4 tests must be public. And since TestFrameworksUtil.isJUnit4Method() does check the visibility, the rule doesn't trigger a violation. That's not what this test is supposed to test.

Unfortunately, if I fix the test (by adding public), the test turns red, indicating that the feature (JUnitTestsShouldIncludeAssert treats soft assertions as assertions, see #1435) is broken in the JUnit4 case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    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