void () { n[0] = 0; expression.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitMethodCallExpression(@NotNull PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); n[0]++; } }); assertEquals(N, n[0]); }