コード例 #1
0
 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;
 }
コード例 #2
0
  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);
  }
コード例 #3
0
  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");
  }