boolean (PsiExpression call) { PsiElement psiElement = PsiTreeUtil.getNonStrictParentOfType(call, PsiFunctionalExpression.class, PsiAnonymousClass.class); PsiElement expressionList; if (psiElement instanceof PsiFunctionalExpression expression) { PsiType lambdaType = expression.getFunctionalInterfaceType(); if (lambdaType == null || InheritanceUtil.isInheritor(lambdaType, JAVA_UTIL_FUNCTION_SUPPLIER)) return false; PsiElement skipParenthesizedExprUp = PsiUtil.skipParenthesizedExprUp(expression); if (skipParenthesizedExprUp == null) return false; expressionList = PsiUtil.skipParenthesizedExprUp(skipParenthesizedExprUp.getParent()); } else if (psiElement instanceof PsiAnonymousClass psiAnonymousClass) { if (!LambdaUtil.isFunctionalType(psiAnonymousClass.getBaseClassType()) || InheritanceUtil.isInheritor(psiAnonymousClass, JAVA_UTIL_FUNCTION_SUPPLIER)) return false; if (!(psiAnonymousClass.getParent() instanceof PsiNewExpression psiNewExpression)) return false; PsiElement skipParenthesizedExprUp = PsiUtil.skipParenthesizedExprUp(psiNewExpression); if (skipParenthesizedExprUp == null) return false; expressionList = PsiUtil.skipParenthesizedExprUp(skipParenthesizedExprUp.getParent()); } else { return false; } if (!(expressionList instanceof PsiExpressionList psiExpressionList) || !(psiExpressionList.getParent() instanceof PsiMethodCallExpression methodCallExpression)) return false; return TEST_OR_MOCK_CONTAINER_METHODS.test(methodCallExpression); }