void () { PsiClass sam = myFixture.addClass("interface I { void foo(); }"); myFixture.addClass("class Some { " + "{ I i = () -> {}; }" + "void doTest(int a) {} " + "void doTest(I i, I j) {} " + "Some intermediate() {} " + "Object intermediate(int a, int b) {} " + "}"); myFixture.addClass("class _WrongSignature {{ I i = a -> {}; I j = () -> true; }}"); myFixture.addClass("class _CallArgumentCountMismatch extends Some {{ " + " doTest(() -> {}); " + " intermediate(4).doTest(() -> {}, () -> {}); " + "}}"); myFixture.addClass("class _KnownTypeVariableAssignment {" + "static Runnable field;" + "{ Runnable r = () -> {}; field = () -> {}; } " + "}"); myFixture.addClass("class _SuperFieldAssignment extends _KnownTypeVariableAssignment {" + "{ field = () -> {}; } " + "}"); myFixture.addClass("import static _KnownTypeVariableAssignment.*; " + "class _StaticallyImportedFieldAssignment {" + "{ field = () -> {}; } " + "}"); CommonProcessors.CollectProcessor<PsiFunctionalExpression> result = new CommonProcessors.CollectProcessor<>(); JavaFunctionalExpressionSearcher.Session session = new JavaFunctionalExpressionSearcher.Session( new FunctionalExpressionSearch.SearchParameters(sam, GlobalSearchScope.allScope(getProject())), result ); session.processResults(); assertSize(1, result.getResults()); for (VirtualFile file : session.getFilesLookedInside()) { assertFalse(file.getName(), file.getName().startsWith("_")); } }