A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/1365 below:

[java] JUnitTestsShouldIncludeAssert false positive · Issue #1365 · pmd/pmd · GitHub

Affects PMD Version: 6.7.0

Rule: JUnitTestsShouldIncludeAssert

Description: The following two test cases are identical, but for the precise text of the annotation before them. But they give different warnings in PMD. My students encountered this with PMD v6.2.0, and I've just confirmed locally that it still occurs on 6.7.0.

Code Sample demonstrating the issue:

import org.junit.Test;

class Style {
  // This triggers the JUnitTestsShouldIncludeWarning rule
  @org.junit.Test(expected = IllegalArgumentException.class)
  public void moveOutOfBoundsFrom() {
    doSomething();
  }
  // This does not
  @Test(expected = IllegalArgumentException.class)
  public void moveOutOfBoundsFrom() {
    doSomething();
  }
}

Running PMD through: Other (custom too invoking PMD.main programmaticallyl, referencing <rule ref="category/java/bestpractices.xml/JUnitTestsShouldIncludeAssert" /> to load this rule)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4