Affects PMD Version: 6.10.0
Rule: JUnitAssertionsShouldIncludeMessage
Description: PMD reports "JUnit assertions should include a message" for AssertJ assertions with message. AssertJ assertions are described in a different way than JUnit or Hamcrest assertions, e.g.
assertThat(actual).as("Assertion message").isEqualTo(expected);
See: http://joel-costigliola.github.io/assertj/assertj-core-features-highlight.html#describe-assertion
Code Sample demonstrating the issue:
@Test
public void shouldMapResult() throws SQLException {
new JdbcSession(this.database.dataSource()).sql(
"insert into test values (1, 2), (2, 3), (3, 4)"
).update(Outcome.VOID);
assertThat(
new JdbcSession(this.database.dataSource()).sql("select * from test")
.select(new MapOutcome<>(rset -> rset.getInt(1), rset -> rset.getInt(2)))
).as("Should return database entries as map")
.hasSize(3)
.containsEntry(1, 2)
.containsEntry(2, 3)
.containsEntry(3, 4);
}
Running PMD through: Maven
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