public RunProfileState getState(
     @NotNull final Executor executor, @NotNull final ExecutionEnvironment env)
     throws ExecutionException {
   return TestObject.fromString(
       myData.TEST_OBJECT,
       getProject(),
       this,
       env.getRunnerSettings(),
       env.getConfigurationSettings());
 }
 public void checkConfiguration() throws RuntimeConfigurationException {
   super.checkConfiguration();
   final String packageName = myConfiguration.getPersistentData().getPackageName();
   final PsiPackage aPackage =
       JavaPsiFacade.getInstance(myConfiguration.getProject()).findPackage(packageName);
   if (aPackage == null) {
     throw new RuntimeConfigurationWarning(
         ExecutionBundle.message("package.does.not.exist.error.message", packageName));
   }
   if (getSourceScope() == null) {
     myConfiguration.getConfigurationModule().checkForWarning();
   }
 }
 @Override
 protected void notifyByBalloon(
     JUnitRunningModel model, boolean started, final JUnitConsoleProperties consoleProperties) {
   if (myFoundTests) {
     super.notifyByBalloon(model, started, consoleProperties);
   } else {
     final String packageName = myConfiguration.getPackage();
     if (packageName == null) return;
     final Project project = myConfiguration.getProject();
     final PsiPackage aPackage = JavaPsiFacade.getInstance(project).findPackage(packageName);
     if (aPackage == null) return;
     final Module module = myConfiguration.getConfigurationModule().getModule();
     if (module == null) return;
     final Set<Module> modulesWithPackage = new HashSet<Module>();
     final PsiDirectory[] directories = aPackage.getDirectories();
     for (PsiDirectory directory : directories) {
       final Module currentModule =
           ModuleUtil.findModuleForFile(directory.getVirtualFile(), project);
       if (module != currentModule && currentModule != null) {
         modulesWithPackage.add(currentModule);
       }
     }
     if (!modulesWithPackage.isEmpty()) {
       final String testRunDebugId =
           consoleProperties.isDebug() ? ToolWindowId.DEBUG : ToolWindowId.RUN;
       final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
       final Function<Module, String> moduleNameRef =
           new Function<Module, String>() {
             @Override
             public String fun(Module module) {
               final String moduleName = module.getName();
               return "<a href=\"" + moduleName + "\">" + moduleName + "</a>";
             }
           };
       String message = "Tests were not found in module \"" + module.getName() + "\".\n" + "Use ";
       if (modulesWithPackage.size() == 1) {
         message += "module \"" + moduleNameRef.fun(modulesWithPackage.iterator().next()) + "\" ";
       } else {
         message += "one of\n" + StringUtil.join(modulesWithPackage, moduleNameRef, "\n") + "\n";
       }
       message += "instead";
       toolWindowManager.notifyByBalloon(
           testRunDebugId,
           MessageType.WARNING,
           message,
           null,
           new ResetConfigurationModuleAdapter(
               project, consoleProperties, toolWindowManager, testRunDebugId));
     }
   }
 }
  protected void initialize() throws ExecutionException {
    super.initialize();
    final JUnitConfiguration.Data data = myConfiguration.getPersistentData();
    getClassFilter(data); // check if junit found
    configureClasspath();

    try {
      myTempFile = FileUtil.createTempFile("idea_junit", ".tmp");
      myTempFile.deleteOnExit();
      myJavaParameters.getProgramParametersList().add("@" + myTempFile.getAbsolutePath());
    } catch (IOException e) {
      LOG.error(e);
    }

    try {
      myServerSocket = new ServerSocket(0, 0, InetAddress.getByName("127.0.0.1"));
      myJavaParameters.getProgramParametersList().add("-socket" + myServerSocket.getLocalPort());
    } catch (IOException e) {
      LOG.error(e);
    }
  }
 public TestObject getTestObject(final Project project, final JUnitConfiguration configuration) {
   // TODO[dyoma]!
   return TestObject.fromString(TEST_OBJECT, project, configuration, null, null);
 }