padaiyal/jPopper

Add PMD checks - JUnitTestsShouldIncludeAssert and JUnitAssertionsShouldIncludeMessage (Latter one is optional)

the-c0d3br34k3r opened this issue · 0 comments

  • Description

    With the current version of the PMD maven plugin there are false positives for JUnitTestsShouldIncludeAssert and false negatives for JUnitAssertionsShouldIncludeMessage.

  • Use cases

    1. To ensure each JUnit test has at least one assertion.
    2. To ensure that all JUnit test assertions have a message. (May not be needed)
  • Proposed design/fix

    I even checked with the latest PMD version (6.30.0) as opposed to the default PMD version used by the plugin (6.29.0). No luck, same failure.
    It looks like they've added some fixes in PMD 7.0.0 for JUnitTestsShouldIncludeAssert and JUnitAssertionsShouldIncludeMessage.

    pmd/pmd@cb1d1c5
    pmd/pmd@f13c8c5

    We can't configure the plugin to use PMD 7.0 as there is no maven artifact for it yet.

    Let's skip these 2 checks for now and keep an open issue to look into it again once we get a PMD 7.0.0 artifact.

  • Alternative design/fix approaches

    We can try to build PMD 7.0.0 ourselves from their branch and include it as a local dependency. Not recommended though.

  • Workaround

    None as of now.

  • Additional information

    Not applicable.