public boolean isGeneratedName(
     final String name, final JavaRunConfigurationModule configurationModule) {
   if (TEST_OBJECT == null) return true;
   if ((TEST_CLASS.equals(TEST_OBJECT) || TEST_METHOD.equals(TEST_OBJECT))
       && getMainClassName().length() == 0) {
     return JavaExecutionUtil.isNewName(name);
   }
   if (TEST_METHOD.equals(TEST_OBJECT) && getMethodName().length() == 0) {
     return JavaExecutionUtil.isNewName(name);
   }
   return Comparing.equal(name, getGeneratedName(configurationModule));
 }
 public void bePatternConfiguration(List<PsiClass> classes, PsiMethod method) {
   data.TEST_OBJECT = TestType.PATTERN.getType();
   final String suffix;
   if (method != null) {
     data.METHOD_NAME = method.getName();
     suffix = "," + data.METHOD_NAME;
   } else {
     suffix = "";
   }
   LinkedHashSet<String> patterns = new LinkedHashSet<String>();
   for (PsiClass pattern : classes) {
     patterns.add(JavaExecutionUtil.getRuntimeQualifiedName(pattern) + suffix);
   }
   data.setPatterns(patterns);
   final Module module =
       RunConfigurationProducer.getInstance(TestNGPatternConfigurationProducer.class)
           .findModule(this, getConfigurationModule().getModule(), patterns);
   if (module == null) {
     data.setScope(TestSearchScope.WHOLE_PROJECT);
     setModule(null);
   } else {
     setModule(module);
   }
   setGeneratedName();
 }
    public String getGeneratedName(final JavaRunConfigurationModule configurationModule) {
      if (TEST_PACKAGE.equals(TEST_OBJECT) || TEST_DIRECTORY.equals(TEST_OBJECT)) {
        final String moduleName =
            TEST_SEARCH_SCOPE.getScope() == TestSearchScope.WHOLE_PROJECT
                ? ""
                : configurationModule.getModuleName();
        final String packageName = getPackageName();
        if (packageName.length() == 0) {
          if (moduleName.length() > 0) {
            return ExecutionBundle.message("default.junit.config.name.all.in.module", moduleName);
          }
          return DEFAULT_PACKAGE_NAME;
        }
        if (moduleName.length() > 0) {
          return ExecutionBundle.message(
              "default.junit.config.name.all.in.package.in.module", packageName, moduleName);
        }
        return packageName;
      }
      if (TEST_PATTERN.equals(TEST_OBJECT)) {
        final int size = myPattern.size();
        if (size == 0) return "Temp suite";
        return StringUtil.getShortName(myPattern.iterator().next())
            + (size > 1 ? " and " + (size - 1) + " more" : "");
      }
      final String className =
          JavaExecutionUtil.getPresentableClassName(getMainClassName(), configurationModule);
      if (TEST_METHOD.equals(TEST_OBJECT)) {
        return className + '.' + getMethodName();
      }

      return className;
    }
 public void bePatternConfiguration(List<PsiClass> classes, PsiMethod method) {
   myData.TEST_OBJECT = TEST_PATTERN;
   final Set<String> patterns = new HashSet<String>();
   final String methodSufiix;
   if (method != null) {
     myData.METHOD_NAME = method.getName();
     methodSufiix = "," + myData.METHOD_NAME;
   } else {
     methodSufiix = "";
   }
   for (PsiClass pattern : classes) {
     patterns.add(JavaExecutionUtil.getRuntimeQualifiedName(pattern) + methodSufiix);
   }
   myData.setPatterns(patterns);
   final Module module =
       PatternConfigurationProducer.findModule(
           this, getConfigurationModule().getModule(), patterns);
   if (module == null) {
     myData.setScope(TestSearchScope.WHOLE_PROJECT);
     setModule(null);
   } else {
     setModule(module);
   }
   setGeneratedName();
 }
 public Module setMainClass(final PsiClass testClass) {
   MAIN_CLASS_NAME = JavaExecutionUtil.getRuntimeQualifiedName(testClass);
   PsiPackage containingPackage = JUnitUtil.getContainingPackage(testClass);
   PACKAGE_NAME = containingPackage != null ? containingPackage.getQualifiedName() : "";
   return JavaExecutionUtil.findModule(testClass);
 }