A RetroSearch Logo

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

Search Query:

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

[java] JUnitAssertionsShouldIncludeMessage false positive with method call · Issue #2883 · pmd/pmd · GitHub

Affects PMD Version: 6.30.0-SNAPSHOT

Rule: JUnitAssertionsShouldIncludeMessage

Description:

From #2871 (comment)

Code Sample demonstrating the issue:

https://chunk.io/pmd/fc7db65b2c6a46eca4c9a0c3012482e2/diff/spring-framework/index.html#A6120

import static org.junit.Assert.assertEquals;

public class AssertionMessageTest {
    public void bar(int expectedLength) {
        try {
            Integer.parseInt("a");
        } catch (RuntimeException e) {
            assertEquals(e.toString(), expectedLength, e.getMessage().length()); // no warning expected
        }
    }
}

Expected outcome:

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]


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