Add test for #5113

This commit is contained in:
Clément Fournier 2024-11-15 16:14:09 +01:00
parent c73e5cb8b1
commit a72ac5845b
No known key found for this signature in database
GPG Key ID: 6F9389D8E390BD4C

View File

@ -2218,4 +2218,24 @@ public class ObtainViaTest {
}
]]></code>
</test-code>
<test-code>
<description>UnusedPrivateMethod #5113</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import java.util.Optional;
public class VarTest {
public Optional<Boolean> foo(int param) {
var optional = param == 0 ? Optional.of(true) : Optional.of(false);
return optional.flatMap(this::dummy);
}
private Optional<Boolean> dummy(boolean foo) {
return Optional.of(foo);
}
}
]]></code>
</test-code>
</test-data>