當前位置: 首頁>>代碼示例>>Java>>正文


Java Description.getTestClass方法代碼示例

本文整理匯總了Java中org.junit.runner.Description.getTestClass方法的典型用法代碼示例。如果您正苦於以下問題:Java Description.getTestClass方法的具體用法?Java Description.getTestClass怎麽用?Java Description.getTestClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.junit.runner.Description的用法示例。


在下文中一共展示了Description.getTestClass方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: apply

import org.junit.runner.Description; //導入方法依賴的package包/類
public Statement apply(final Statement base, Description description) {
    Class<?> testClass = description.getTestClass();
    init(description.getMethodName(), testClass.getSimpleName());

    suppressCleanupErrors = testClass.getAnnotation(LeaksFileHandles.class) != null
        || description.getAnnotation(LeaksFileHandles.class) != null;

    return new TestDirectoryCleaningStatement(base, description.getDisplayName());
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:10,代碼來源:AbstractTestDirectoryProvider.java

示例2: resolveOptions

import org.junit.runner.Description; //導入方法依賴的package包/類
private BenchmarkOptions resolveOptions(Description description) {
    // Method-level
    BenchmarkOptions options = description.getAnnotation(BenchmarkOptions.class);
    if (options != null) return options;
    
    // Class-level
    Class<?> clz = description.getTestClass();
    while (clz != null)
    {
        options = clz.getAnnotation(BenchmarkOptions.class);
        if (options != null) return options;

        clz = clz.getSuperclass();
    }

    // Defaults.
    try
    {
        return getClass()
            .getDeclaredMethod("defaultOptions")
            .getAnnotation(BenchmarkOptions.class);
    }
    catch (Exception e)
    {
        throw new RuntimeException(e);
    }
}
 
開發者ID:adnanmitf09,項目名稱:Rubus,代碼行數:28,代碼來源:BenchmarkStatement.java

示例3: starting

import org.junit.runner.Description; //導入方法依賴的package包/類
/**
 * sets test class and method name to build path to file
 *
 * @param description description of the current test method
 */
@Override
protected void starting(Description description) {
    this.testClass = description.getTestClass();
    this.methodName = description.getMethodName();
}
 
開發者ID:YashchenkoN,項目名稱:jsonverifier,代碼行數:11,代碼來源:JsonContentLoader.java

示例4: testStarted

import org.junit.runner.Description; //導入方法依賴的package包/類
/**
 *
 * @see org.junit.runner.notification.RunListener#testStarted(org.junit.runner.Description)
 */
@Override
public void testStarted( Description description ) throws Exception {

    if (log.isDebugEnabled()) {

        log.debug("testStarted(): Called when an atomic test is about to be started. Description generally class and method: "
                  + description); //, new Exception( "debugging trace" ) );

    }
    lastStartedMethodIsFailing = false;
    Class<?> testClass = description.getTestClass(); //testResult.getTestClass().getRealClass();

    String suiteName;
    String suiteSimpleName;
    String tcName = getTestName(description);
    // Update last started method. Note that testStarted() is invoked even before @Before methods
    lastStartedMethod = description.getMethodName(); // TODO: check for overridden methods
    String tcDescription = getTestDescription(description);

    suiteName = testClass.getName(); // assuming not JUnit 3 class "TestSuite"
    suiteSimpleName = testClass.getSimpleName();

    // check if we need to start a new group
    if (!suiteName.equals(lastSuiteName)) {
        if (lastSuiteName != null) {
            logger.endSuite();
        }

        String packName = suiteName.substring(0, suiteName.lastIndexOf('.'));
        logger.startSuite(packName, suiteSimpleName);
        lastSuiteName = suiteName;
    }

    // start a scenario and test case
    logger.startTestcase(suiteName, suiteSimpleName, tcName, "", tcDescription);

    // send TestStart event to all ATS agents
    TestcaseStateEventsDispacher.getInstance().onTestStart();

    logger.info("[JUnit]: Starting " + suiteName + "@" + tcName);
    super.testStarted(description);
}
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:47,代碼來源:AtsJunitTestListener.java

示例5: extractNameFromDescription

import org.junit.runner.Description; //導入方法依賴的package包/類
private String extractNameFromDescription(final Description description) {
    return description.getTestClass() == null ? description.getClassName() : description.getTestClass()
                                                                                        .getSimpleName();
}
 
開發者ID:zapodot,項目名稱:embedded-jms-junit,代碼行數:5,代碼來源:EmbeddedJmsRuleImpl.java

示例6: testStarted

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
public void testStarted(final Description description) throws Exception {

    if (!Objects.equals(lastClassName, description.getTestClass())) {

        lastClassName = description.getTestClass();
        lastMethodName = null;

        println("\n");

        println(simplifyClassName(lastClassName) + "\n");

    }

}
 
開發者ID:galop-proxy,項目名稱:galop,代碼行數:16,代碼來源:ExecutionListener.java


注:本文中的org.junit.runner.Description.getTestClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。