Skip to content

[java] JUnitTestsShouldIncludeAssert false positive #631

@cesares-basilico

Description

@cesares-basilico

Rule Set: pmd-unit-tests:JUnitTestsShouldIncludeAssert

Description: I got this false positive, the assertion in implicit with the expected exception rule.

Code Sample demonstrating the issue:

@Rule
public ExpectedException expectedEx = ExpectedException.none();

@Test
public void testCheckStateBoOperatorNoCsId() {
  expectedEx.expect(InvalidUserException.class);
  expectedEx.expect(ErrorMatcher.hasCode(ErrorCodes.XXX));
  xxx.yyy();
}

Running PMD through: Maven

Metadata

Metadata

Assignees

Labels

a:false-positivePMD flags a piece of code that is not problematic

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions