Affects PMD Version: 7.23.0
Rule: UnusedPrivateField
Description: When a private field is used as an argument source for a @ParameterizedTest, it is reported as unused by PMD.
Code Sample demonstrating the issue:
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.FieldSource;
import java.util.List;
class FooTest {
private static final List<String> foo = List.of("a");
@ParameterizedTest
@FieldSource("foo")
void testFoo(String arg) {}
}
Expected outcome:
PMD reports a violation at line 7, but that's wrong. That's a false positive.
Running PMD through: CLI
Affects PMD Version: 7.23.0
Rule: UnusedPrivateField
Description: When a private field is used as an argument source for a @ParameterizedTest, it is reported as unused by PMD.
Code Sample demonstrating the issue:
Expected outcome:
PMD reports a violation at line 7, but that's wrong. That's a false positive.
Running PMD through: CLI