本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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);
}
}