protected ModuleBasedConfiguration createInstance() {
   return new JUnitConfiguration(
       getName(),
       getProject(),
       myData.clone(),
       JUnitConfigurationType.getInstance()
           .getConfigurationFactories()[0]); // throw new RuntimeException("Should not call");
 }
 private JUnitConfiguration createConfiguration(PsiPackage psiPackage, Module module) {
   JUnitConfiguration configuration =
       new JUnitConfiguration(
           "", myProject, JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
   configuration.getPersistentData().TEST_OBJECT = JUnitConfiguration.TEST_PACKAGE;
   configuration.getPersistentData().PACKAGE_NAME = psiPackage.getQualifiedName();
   configuration.getPersistentData().setScope(TestSearchScope.WHOLE_PROJECT);
   configuration.setModule(module);
   return configuration;
 }
  public void testExternalizeJUnitConfiguration()
      throws WriteExternalException, InvalidDataException {
    JUnitConfiguration configuration = createConfiguration(findTestA(getModule1()));
    Element element = new Element("cfg");
    configuration.writeExternal(element);
    JUnitConfiguration newCfg =
        new JUnitConfiguration(
            null, myProject, JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);

    newCfg.readExternal(element);
    checkTestObject(configuration.getPersistentData().TEST_OBJECT, newCfg);
    assertEquals(
        Collections.singleton(getModule1()), ContainerUtilRt.newHashSet(newCfg.getModules()));
    checkClassName(configuration.getPersistentData().getMainClassName(), newCfg);
  }
  public void testRunAllInPackageWhenPackageIsEmptyInModule() throws ExecutionException {
    assignJdk(getModule2());
    JUnitConfiguration configuration =
        new JUnitConfiguration(
            "", myProject, JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
    configuration.getPersistentData().TEST_OBJECT = JUnitConfiguration.TEST_PACKAGE;
    configuration.getPersistentData().PACKAGE_NAME = "test2";
    configuration.getPersistentData().setScope(TestSearchScope.WHOLE_PROJECT);
    assertEmpty(configuration.getModules());
    checkCanRun(configuration);
    configuration.getPersistentData().PACKAGE_NAME = "noTests";
    //    checkCantRun(configuration, "No tests found in the package '");

    configuration.getPersistentData().PACKAGE_NAME = "com.abcent";
    checkCantRun(configuration, "Package 'com.abcent' not found");
  }