diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml index 3a91d558ef..cc6b1643cc 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml @@ -1901,6 +1901,40 @@ public class NotUsedPrivateMethodFalsePositive { return clientIdsToDps.getUnchecked(""); } } +]]> + + + + [java] UnusedPrivateMethod false positive when using @MethodSource on a @Nested test #4975 + 0 + strings) { + // insert code + } + + private static Stream getStrings() { + Stream tests = Stream.of( + Arguments.of(List.of("TEST", "TEST_1")), + Arguments.of(List.of("TEST_2", "TEST_3")) + ); + + return Stream.of(tests) + .reduce(Stream::concat) + .orElseGet(Stream::empty); + } + } +} ]]>