当前位置: 首页>>代码示例>>Java>>正文


Java Parser类代码示例

本文整理汇总了Java中org.testng.xml.Parser的典型用法代码示例。如果您正苦于以下问题:Java Parser类的具体用法?Java Parser怎么用?Java Parser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Parser类属于org.testng.xml包,在下文中一共展示了Parser类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkConfiguration

import org.testng.xml.Parser; //导入依赖的package包/类
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
  final TestData data = myConfig.getPersistantData();
  try {
    final Parser parser = new Parser(data.getSuiteName());
    parser.setLoadClasses(false);
    synchronized (PARSE_LOCK) {
      parser.parse();//try to parse suite.xml
    }
  }
  catch (Exception e) {
    throw new RuntimeConfigurationException("Unable to parse '" + data.getSuiteName() + "' specified");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:TestNGTestSuite.java

示例2: checkConfiguration

import org.testng.xml.Parser; //导入依赖的package包/类
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
  if (data.TEST_OBJECT.equals(TestType.CLASS.getType()) || data.TEST_OBJECT.equals(TestType.METHOD.getType())) {
    final SourceScope scope = data.getScope().getSourceScope(this);
    if (scope == null) {
      throw new RuntimeConfigurationException("Invalid scope specified");
    }
    PsiClass psiClass = JavaPsiFacade.getInstance(project).findClass(data.getMainClassName(), scope.getGlobalSearchScope());
    if (psiClass == null) throw new RuntimeConfigurationException("Class '" + data.getMainClassName() + "' not found");
    if (data.TEST_OBJECT.equals(TestType.METHOD.getType())) {
      PsiMethod[] methods = psiClass.findMethodsByName(data.getMethodName(), true);
      if (methods.length == 0) {
        throw new RuntimeConfigurationException("Method '" + data.getMethodName() + "' not found");
      }
      for (PsiMethod method : methods) {
        if (!method.hasModifierProperty(PsiModifier.PUBLIC)) {
          throw new RuntimeConfigurationException("Non public method '" + data.getMethodName() + "'specified");
        }
      }
    }
  }
  else if (data.TEST_OBJECT.equals(TestType.PACKAGE.getType())) {
    PsiPackage psiPackage = JavaPsiFacade.getInstance(project).findPackage(data.getPackageName());
    if (psiPackage == null) throw new RuntimeConfigurationException("Package '" + data.getPackageName() + "' not found");
  }
  else if (data.TEST_OBJECT.equals(TestType.SUITE.getType())) {
    try {
      final Parser parser = new Parser(data.getSuiteName());
      parser.setLoadClasses(false);
      synchronized (PARSE_LOCK) {
        parser.parse();//try to parse suite.xml
      }
    }
    catch (Exception e) {
      throw new RuntimeConfigurationException("Unable to parse '" + data.getSuiteName() + "' specified");
    }
  } else if (data.TEST_OBJECT.equals(TestType.PATTERN.getType())) {
    final Set<String> patterns = data.getPatterns();
    if (patterns.isEmpty()) {
      throw new RuntimeConfigurationWarning("No pattern selected");
    }
  }
  JavaRunConfigurationExtensionManager.checkConfigurationIsValid(this);
  ProgramParametersUtil.checkWorkingDirectoryExist(this, getProject(), getConfigurationModule().getModule());
  JavaParametersUtil.checkAlternativeJRE(this);
  //TODO add various checks here
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:48,代码来源:TestNGConfiguration.java


注:本文中的org.testng.xml.Parser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。