A RetroSearch Logo

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

Search Query:

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

GitHub ยท Where software is built

Rule Set: JUnit

Description: Currently, the JUnitTestsShouldIncludeAssertRule checks whether a method is annotated @Test(expected = ...class) to check for expected exceptions. JUnit4 includes the @Rule form to define ExpectedExceptions, too, but if code uses that, then the rule above will fire and complain that no assertions were found.

Code Sample demonstrating the issue:
(Excerpted from https://github.com/junit-team/junit4/wiki/Rules)

public class DigitalAssetManagerTest {
  @Rule
  public final ExpectedException exception = ExpectedException.none();
  @Test
  public void throwsIllegalArgumentExceptionIfIconIsNull() {
    exception.expect(IllegalArgumentException.class);
    exception.expectMessage("Icon is null, not a file, or doesn't exist.");
    new DigitalAssetManager(null, null);
  }
}

It seems to me the rule needs to check:

I tried writing this rule in XPath, but got stymied trying to match up the field name correctly...

Running PMD through: CLI


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