void () { myFixture.addClass(""" @FunctionalInterface public interface MyFunc { void accept(int value); } """); PsiClass fooClass = myFixture.addClass("class Foo { void foo(int i) {}}"); PsiDeclarationStatement fooVar = getElementFactory().createVariableDeclarationStatement("foo", getElementFactory().createType(fooClass), null, fooClass); PsiExpression methodReference = getElementFactory().createExpressionFromText("foo::foo", fooVar); assertInstanceOf(methodReference, PsiMethodReferenceExpression.class); final PsiMethodReferenceExpression expression = (PsiMethodReferenceExpression)methodReference; Collection<? extends PsiType> suggestedTypes = FunctionalInterfaceSuggester.suggestFunctionalInterfaces(expression); checkWithExpected(suggestedTypes, "MyFunc", "java.util.function.Consumer<java.lang.Integer>", "java.util.function.IntConsumer"); }