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


Java Description.getChildren方法代码示例

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


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

示例1: map

import org.junit.runner.Description; //导入方法依赖的package包/类
private void map(Description source, Description parent) {
    for (Description child : source.getChildren()) {
        Description mappedChild;
        if (child.getMethodName() != null) {
            mappedChild = Description.createSuiteDescription(String.format("%s [%s](%s)", child.getMethodName(), getDisplayName(), child.getClassName()));
            parent.addChild(mappedChild);
            if (!isTestEnabled(new TestDescriptionBackedTestDetails(source, child))) {
                disabledTests.add(child);
            } else {
                enabledTests.add(child);
            }
        } else {
            mappedChild = Description.createSuiteDescription(child.getClassName());
        }
        descriptionTranslations.put(child, mappedChild);
        map(child, parent);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:AbstractMultiTestRunner.java

示例2: shouldRun

import org.junit.runner.Description; //导入方法依赖的package包/类
@Override
public boolean shouldRun(final Description description) {
    if (description.isTest()) {
        return delegate.shouldRun(description);
    }

    // explicitly check if any children want to run
    for (Description child : description.getChildren()) {
        if (shouldRun(child)) {
            return true;
        }
        //Intellij bug, we get the wrong description, let us test with a slightly modified one now
        final Description relaxed = Description.createTestDescription(
                child.getTestClass(), getMethodName(child.getDisplayName())
        );
        if (shouldRun(relaxed)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:tools4j,项目名称:spockito,代码行数:22,代码来源:MethodLevelFilter.java

示例3: shouldRun

import org.junit.runner.Description; //导入方法依赖的package包/类
@Override
public boolean shouldRun(Description description) {
    if (matcher.matchesTest(JUnitTestEventAdapter.className(description), JUnitTestEventAdapter.methodName(description))) {
        return true;
    }

    for (Description child : description.getChildren()) {
        if (shouldRun(child)) {
            return true;
        }
    }

    return false;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:15,代码来源:JUnitTestClassExecuter.java

示例4: getAllDescriptions

import org.junit.runner.Description; //导入方法依赖的package包/类
List<Description> getAllDescriptions(Description description, String className) {
    final AllExceptIgnoredTestRunnerBuilder allExceptIgnoredTestRunnerBuilder = new AllExceptIgnoredTestRunnerBuilder();
    try {
        final Class<?> testClass = description.getClass().getClassLoader().loadClass(className);
        Runner runner = allExceptIgnoredTestRunnerBuilder.runnerForClass(testClass);
        if (runner == null) {
            //fall back to default runner
            runner = Request.aClass(testClass).getRunner();
        }
        final Description runnerDescription = runner.getDescription();
        return runnerDescription.getChildren();
    } catch (Throwable throwable) {
        throw new TestSuiteExecutionException(String.format("Unable to process Ignored class %s.", className), throwable);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:IgnoredTestDescriptorProvider.java


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