當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。