private boolean configure(
      TestNGConfiguration configuration,
      Location location,
      ConfigurationContext context,
      Project project,
      @Nullable PsiClass delegate,
      @Nullable PsiMethod method) {
    if (delegate == null) {
      return false;
    }

    setupConfigurationModule(context, configuration);
    Module originalModule = configuration.getConfigurationModule().getModule();
    configuration.setClassConfiguration(delegate);
    if (method != null) {
      configuration.setMethodConfiguration(PsiLocation.fromPsiElement(project, method));
    }
    configuration.restoreOriginalModule(originalModule);
    configuration.setName(configuration.getName());
    JavaRunConfigurationExtensionManager.getInstance()
        .extendCreatedConfiguration(configuration, location);
    return true;
  }
 public void setPsiElement(final PsiPackage psiPackage) {
   setName(psiPackage.getQualifiedName());
 }
 public void setPsiElement(final PsiClass psiClass) {
   setName(psiClass.getQualifiedName());
 }