void () { final PsiClass aClass = myFixture.addClass(""" class Test { Runnable r = () -> { }; public void method() { Runnable r = () -> { Integer s = RedundantRename.this.s; Runnable rr = () -> {}; new Runnable() { Runnable r1 = () -> {}; @Override public void run() {} }; }; } }"""); final Collection<PsiLambdaExpression> lambdaExpressions = PsiTreeUtil.findChildrenOfType(aClass, PsiLambdaExpression.class); final String[] expectedNames = {"lambda$new$0", "lambda$method$1", "lambda$method$2", "lambda$0"}; int idx = 0; for (PsiLambdaExpression expression : lambdaExpressions) { assertEquals(expectedNames[idx++], PsiLambdaNameHelper.getVMName(expression)); } }