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