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


Java TestResult.runProtected方法代碼示例

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


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

示例1: run

import junit.framework.TestResult; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 * <p/>
 * <p/> Replacement run method. Gets a hold of the TestRunner used for running this test so it can populate it with
 * the results retrieved from OSGi.
 */
public final void run(TestResult result) {

    // get a hold of the test result
    originalResult = result;

    result.startTest(osgiJUnitTest);
    result.runProtected(osgiJUnitTest, new Protectable() {

        public void protect() throws Throwable {
            AbstractOsgiTests.this.runBare();
        }
    });
    result.endTest(osgiJUnitTest);

    // super.run(result);
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:23,代碼來源:AbstractOsgiTests.java

示例2: run

import junit.framework.TestResult; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 * 
 * <p/> Replacement run method. Gets a hold of the TestRunner used for
 * running this test so it can populate it with the results retrieved from
 * OSGi.
 */
public final void run(TestResult result) {

	// get a hold of the test result
	originalResult = result;

	result.startTest(osgiJUnitTest);
	result.runProtected(osgiJUnitTest, new Protectable() {

		public void protect() throws Throwable {
			AbstractOsgiTests.this.runBare();
		}
	});
	result.endTest(osgiJUnitTest);

	// super.run(result);
}
 
開發者ID:BeamFoundry,項目名稱:spring-osgi,代碼行數:24,代碼來源:AbstractOsgiTests.java

示例3: run

import junit.framework.TestResult; //導入方法依賴的package包/類
@Override
public void run(final TestResult result) {
    result.runProtected(this, new Protectable() {
        public @Override void protect() throws Throwable {
            ClassLoader before = Thread.currentThread().getContextClassLoader();
            try {
                runInRuntimeContainer(result);
            } finally {
                Thread.currentThread().setContextClassLoader(before);
            }
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:NbModuleSuite.java

示例4: runTest

import junit.framework.TestResult; //導入方法依賴的package包/類
/**
 * Run fixture setup, test from the given test case and fixture teardown.
 *
 * @param osgiTestExtensions
 * @param testName
 */
protected TestResult runTest(final OsgiJUnitTest osgiTestExtensions, String testName) {
    if (log.isDebugEnabled()) {
        log.debug("Running test [" + testName + "] on testCase " + osgiTestExtensions);
    }

    final TestResult result = new TestResult();
    TestCase rawTest = osgiTestExtensions.getTestCase();
    rawTest.setName(testName);

    try {
        osgiTestExtensions.osgiSetUp();

        try {
            // use TestResult method to bypass the setUp/tearDown methods
            result.runProtected(rawTest, new Protectable() {

                public void protect() throws Throwable {
                    osgiTestExtensions.osgiRunTest();
                }

            });
        } finally {
            osgiTestExtensions.osgiTearDown();
        }
    }
    // exceptions thrown by osgiSetUp/osgiTearDown
    catch (Exception ex) {
        log.error("test exception threw exception ", ex);
        result.addError(rawTest, ex);
    }
    return result;
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:39,代碼來源:OsgiJUnitService.java

示例5: run

import junit.framework.TestResult; //導入方法依賴的package包/類
public void run(TestResult result) {
	result.startTest(this);
	Protectable p= new Protectable() {
		public void protect() throws Throwable {
			fTestCase.runBare();
			fTestCase.runBare();
		}
	};
	result.runProtected(this, p);
	result.endTest(this);
}
 
開發者ID:cacheonix,項目名稱:cacheonix-core,代碼行數:12,代碼來源:TestImplementorTest.java

示例6: run

import junit.framework.TestResult; //導入方法依賴的package包/類
@Override
public void run(final TestResult result) {
    Protectable p = new Protectable() {
        public void protect() throws Exception {
            setUp();
            basicRun(result);
            tearDown();
        }
    };
    result.runProtected(this, p);
}
 
開發者ID:DIVERSIFY-project,項目名稱:sosiefier,代碼行數:12,代碼來源:TestSetup.java

示例7: run

import junit.framework.TestResult; //導入方法依賴的package包/類
public void run(TestResult result) {
    result.startTest(this);
    Protectable p = new Protectable() {
        public void protect() throws Throwable {
            fTestCase.runBare();
            fTestCase.runBare();
        }
    };
    result.runProtected(this, p);
    result.endTest(this);
}
 
開發者ID:DIVERSIFY-project,項目名稱:sosiefier,代碼行數:12,代碼來源:TestImplementorTest.java

示例8: runTest

import junit.framework.TestResult; //導入方法依賴的package包/類
/**
 * Run fixture setup, test from the given test case and fixture teardown.
 * 
 * @param osgiTestExtensions
 * @param testName
 */
protected TestResult runTest(final OsgiJUnitTest osgiTestExtensions, String testName) {
	if (log.isDebugEnabled())
		log.debug("Running test [" + testName + "] on testCase " + osgiTestExtensions);
	final TestResult result = new TestResult();
	TestCase rawTest = osgiTestExtensions.getTestCase();

	rawTest.setName(testName);

	try {
		osgiTestExtensions.osgiSetUp();

		try {
			// use TestResult method to bypass the setUp/tearDown methods
			result.runProtected(rawTest, new Protectable() {

				public void protect() throws Throwable {
					osgiTestExtensions.osgiRunTest();
				}

			});
		}
		finally {
			osgiTestExtensions.osgiTearDown();
		}

	}
	// exceptions thrown by osgiSetUp/osgiTearDown
	catch (Exception ex) {
		log.error("test exception threw exception ", ex);
		result.addError((Test) rawTest, ex);
	}
	return result;
}
 
開發者ID:BeamFoundry,項目名稱:spring-osgi,代碼行數:40,代碼來源:OsgiJUnitService.java


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