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 1a6dd1488d..ae0fc5e242 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 @@ -2218,4 +2218,24 @@ public class ObtainViaTest { } ]]> + + + UnusedPrivateMethod #5113 + 0 + foo(int param) { + var optional = param == 0 ? Optional.of(true) : Optional.of(false); + return optional.flatMap(this::dummy); + } + + private Optional dummy(boolean foo) { + return Optional.of(foo); + } + } + ]]> + +