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


Java ClassRequest类代码示例

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


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

示例1: getSuiteMethodDescription

import org.junit.internal.requests.ClassRequest; //导入依赖的package包/类
private static Description getSuiteMethodDescription(Request request, Description description) throws NoSuchFieldException, IllegalAccessException {
  Field field;
  try {
    field = ClassRequest.class.getDeclaredField("fTestClass");
  }
  catch (NoSuchFieldException e) {
    field = ClassRequest.class.getDeclaredField("testClass");
  }
  field.setAccessible(true);
  final Description methodDescription = Description.createSuiteDescription((Class)field.get(request));
  for (Iterator iterator = description.getChildren().iterator(); iterator.hasNext();) {
    methodDescription.addChild((Description)iterator.next());
  }
  description = methodDescription;
  return description;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JUnit4IdeaTestRunner.java

示例2: getTestToStart

import org.junit.internal.requests.ClassRequest; //导入依赖的package包/类
public Object getTestToStart(String[] args) {
  final Request request = JUnit4TestRunnerUtil.buildRequest(args, false);
  if (request == null) return null;
  final Runner testRunner = request.getRunner();
  Description description = null;
  try {
    description = testRunner.getDescription();
    if (request instanceof ClassRequest) {
      description = getSuiteMethodDescription(request, description);
    }
    else if (request instanceof FilterRequest) {
      description = getFilteredDescription(request, description);
    }
  }
  catch (Exception e) {
    //noinspection HardCodedStringLiteral
    System.err.println("Internal Error occured.");
    e.printStackTrace(System.err);
  }
  return description;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:JUnit4IdeaTestRunner.java

示例3: getDescription

import org.junit.internal.requests.ClassRequest; //导入依赖的package包/类
private static Description getDescription(Request request, Runner testRunner) throws NoSuchFieldException, IllegalAccessException {
  Description description = testRunner.getDescription();
  if (description == null) {
    System.err.println("Nothing found to run. Runner " + testRunner.getClass().getName() + " provides no description.");
    return null;
  }
  if (request instanceof ClassRequest) {
    description = getSuiteMethodDescription(request, description);
  }
  else if (request instanceof FilterRequest) {
    description = getFilteredDescription(request, description);
  }
  return description;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JUnit4IdeaTestRunner.java

示例4: createIgnoreIgnoredClassRequest

import org.junit.internal.requests.ClassRequest; //导入依赖的package包/类
private static Request createIgnoreIgnoredClassRequest(final Class clazz, final boolean recursively) throws ClassNotFoundException {
  Class.forName("org.junit.runners.BlockJUnit4ClassRunner"); //ignore IgnoreIgnored for junit4.4 and <
  return new ClassRequest(clazz) {
    public Runner getRunner() {
      try {
        return new IgnoreIgnoredTestJUnit4ClassRunner(clazz, recursively);
      }
      catch (Exception ignored) {
        //return super runner
      }
      return super.getRunner();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JUnit4TestRunnerUtil.java

示例5: getSuiteMethodDescription

import org.junit.internal.requests.ClassRequest; //导入依赖的package包/类
private static Description getSuiteMethodDescription(Request request, Description description) throws NoSuchFieldException, IllegalAccessException {
  final Field field = ClassRequest.class.getDeclaredField("fTestClass");
  field.setAccessible(true);
  final Description methodDescription = Description.createSuiteDescription((Class)field.get(request));
  for (Iterator iterator = description.getChildren().iterator(); iterator.hasNext();) {
    methodDescription.addChild((Description)iterator.next());
  }
  description = methodDescription;
  return description;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:JUnit4IdeaTestRunner.java

示例6: aClass

import org.junit.internal.requests.ClassRequest; //导入依赖的package包/类
/**
 * Create a <code>Request</code> that, when processed, will run all the tests
 * in a class. The odd name is necessary because <code>class</code> is a reserved word.
 *
 * @param clazz the class containing the tests
 * @return a <code>Request</code> that will cause all tests in the class to be run
 */
public static Request aClass(Class<?> clazz) {
    return new ClassRequest(clazz);
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:11,代码来源:Request.java

示例7: classWithoutSuiteMethod

import org.junit.internal.requests.ClassRequest; //导入依赖的package包/类
/**
 * Create a <code>Request</code> that, when processed, will run all the tests
 * in a class. If the class has a suite() method, it will be ignored.
 *
 * @param clazz the class containing the tests
 * @return a <code>Request</code> that will cause all tests in the class to be run
 */
public static Request classWithoutSuiteMethod(Class<?> clazz) {
    return new ClassRequest(clazz, false);
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:11,代码来源:Request.java


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