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


Java FrameworkMethod.getName方法代码示例

本文整理汇总了Java中org.junit.runners.model.FrameworkMethod.getName方法的典型用法代码示例。如果您正苦于以下问题:Java FrameworkMethod.getName方法的具体用法?Java FrameworkMethod.getName怎么用?Java FrameworkMethod.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.junit.runners.model.FrameworkMethod的用法示例。


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

示例1: computeTestMethods

import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
protected List<FrameworkMethod> computeTestMethods() {
    // get all methods to be tested
    List<FrameworkMethod> toSort = super.computeTestMethods();
 
    if (toSort.isEmpty())
        return toSort;
 
    // a map containing <line_number, method>
    final Map<Integer, FrameworkMethod> testMethods = new TreeMap<Integer, FrameworkMethod> ();
 
    // check that all methods here are declared in the same class, we don't
    // deal with test methods from superclasses that haven't been overridden
    Class<?> clazz = getDeclaringClass(toSort);
    if (clazz == null) {
        // fail explicitly
        System.err
                .println("OrderedTestRunner can only run test classes that"
                        + " don't have test methods inherited from superclasses");
        return Collections.emptyList();
    }
 
    // use Javassist to figure out line numbers for methods
    ClassPool pool = ClassPool.getDefault();
    try {
        CtClass cc = pool.get(clazz.getName());
        // all methods in toSort are declared in the same class, we checked
        for (FrameworkMethod m : toSort) {
            String methodName = m.getName();
            CtMethod method = cc.getDeclaredMethod(methodName);
            testMethods.put(method.getMethodInfo().getLineNumber(0), m);
        }
    } catch (NotFoundException e) {
        e.printStackTrace();
    }
 
    return new ArrayList<FrameworkMethod>(testMethods.values());
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:39,代码来源:OrderedTestRunner.java

示例2: testName

import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
protected String testName(final FrameworkMethod method) {
    if (method instanceof UnrolledTestMethod) {
        return method.getName() + Spockito.getName(method.getMethod(), ((UnrolledTestMethod)method).getTableRow());
    }
    return super.testName(method);
}
 
开发者ID:tools4j,项目名称:spockito,代码行数:8,代码来源:SingleTestMultiRowRunner.java

示例3: starting

import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
public void starting(FrameworkMethod method) {
    // By default, disable starting a JettyAdminServer in tests to avoid
    // accidentally attempting to start multiple admin servers on the
    // same port.
    System.setProperty("zookeeper.admin.enableServer", "false");
    // ZOOKEEPER-2693 disables all 4lw by default.
    // Here we enable the 4lw which ZooKeeper tests depends.
    System.setProperty("zookeeper.4lw.commands.whitelist", "*");
    testName = method.getName();
    LOG.info("STARTING " + testName);
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:13,代码来源:ZKTestCase.java

示例4: apply

import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
public Statement apply(Statement statement, FrameworkMethod frameworkMethod, Object o) {
  TestHdfs testHdfsAnnotation = frameworkMethod.getAnnotation(TestHdfs.class);
  if (testHdfsAnnotation != null) {
    statement = new HdfsStatement(statement, frameworkMethod.getName());
  }
  return super.apply(statement, frameworkMethod, o);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:TestHdfsHelper.java

示例5: starting

import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
public void starting(FrameworkMethod method) {
    testName = method.getName();
    // ZOOKEEPER-2693 disables all 4lw by default.
    // Here we enable the 4lw which ZooKeeper tests depends.
    System.setProperty("zookeeper.4lw.commands.whitelist", "*");

    LOG.info("STARTING " + testName);
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:10,代码来源:ZKTestCase.java

示例6: testName

import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
/**
 * Implements behavior from: org.junit.runners.Parameterized$TestClassRunnerForParameters
 */
@Override
protected String testName(FrameworkMethod method) {
	return method.getName() + getName();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:XtextParametrizedRunner.java

示例7: starting

import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
public void starting(FrameworkMethod method) {
    testName = method.getName();
    LOG.info("STARTING " + testName);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:6,代码来源:ZKTestCase.java

示例8: LoggedInvokeMethod

import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
public LoggedInvokeMethod(FrameworkMethod method, Object target) {
    super(method, target);
    this.method = method;
    name = method.getName();
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:6,代码来源:JUnit4ZKTestRunner.java

示例9: testName

import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
protected String testName(FrameworkMethod method) {
  return method.getName() + "@" + suiteClass.getName();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:5,代码来源:SuiteBlockRunner.java

示例10: methodBlock

import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
protected Statement methodBlock(FrameworkMethod frameworkMethod) {
    WebtrekkBaseMainTest.mTestName = frameworkMethod.getName();
    return super.methodBlock(frameworkMethod);
}
 
开发者ID:Webtrekk,项目名称:webtrekk-android-sdk,代码行数:6,代码来源:WebtrekkClassRunner.java


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