private static void doRefactoring(@NotNull Project project, @NotNull GrImportStatement importStatement, @NotNull PsiMember member) {
    if (member instanceof GrAccessorMethod &&
        !importStatement.isOnDemand() &&
        !Objects.equals(importStatement.getImportedName(), member.getName())) {
      member = ((GrAccessorMethod)member).getProperty();
    }

    final GroovyFileBase file = (GroovyFileBase)importStatement.getContainingFile();
    final List<UsageInfo> usages = findUsages(member, file);
    GrImportStatement templateImport = createTemplateImport(project, member, file);

    if (ApplicationManager.getApplication().isUnitTestMode()) {
      if (!importStatement.isOnDemand()) {
        importStatement.delete();
      }
      updateRefs(usages, member.getName(), templateImport);
    }
    else {
      runTemplate(project, importStatement, member, file, usages, templateImport);
    }
  }
private static void doRefactoring(@NotNull Project project, @NotNull GrImportStatement importStatement, @NotNull PsiMember member)