RuleSet: JUnit
Description: Related to #285, the following variant on the code there will produce an error about missing assertions:
public class DigitalAssetManagerTest { @Rule public final ExpectedException exception = ExpectedException.none(); @Test public void throwsIllegalArgumentExceptionIfIconIsNull() { this.exception.expect(IllegalArgumentException.class); this.exception.expectMessage("Icon is null, not a file, or doesn't exist."); new DigitalAssetManager(null, null); } }
If either of the this.exception
s are changed to merely exception
, then the reported error goes away. While the code samples in https://github.com/junit-team/junit4/wiki/Rules don't display the use of this.
as a general matter, it is semantically allowed.
This is run with v5.8.1 of PMD via the command line, so it's current behavior.
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