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