PsiElement (@NotNull String name) { final GroovyFileBase file = createGroovyFileChecked(name + " foo() {}"); final GrTopStatement[] definitions = file.getTopStatements(); if (definitions.length != 1) throw new IncorrectOperationException(name); return definitions[0].getFirstChild().getFirstChild(); }