List of usage examples for junit.framework TestResult addError
public synchronized void addError(Test test, Throwable t)
From source file:org.apache.axis2.transport.testkit.ManagedTestSuite.java
@Override public void run(TestResult result) { LogManager logManager = LogManager.INSTANCE; if (!reuseResources) { super.run(result); } else {/*from w w w. j a v a2 s.co m*/ TestResourceSet resourceSet = null; for (Enumeration<?> e = tests(); e.hasMoreElements();) { Test test = (Test) e.nextElement(); if (test instanceof ManagedTestCase) { ManagedTestCase ttest = (ManagedTestCase) test; TestResourceSet newResourceSet = ttest.getResourceSet(); try { if (resourceSet == null) { logManager.setTestCase(ttest); newResourceSet.setUp(); } else { TestResourceSetTransition transition = new TestResourceSetTransition(resourceSet, newResourceSet); transition.tearDown(); logManager.setTestCase(ttest); transition.setUp(); } } catch (Throwable t) { result.addError(this, t); return; } resourceSet = newResourceSet; } runTest(test, result); } if (resourceSet != null) { try { resourceSet.tearDown(); logManager.setTestCase(null); } catch (Throwable t) { result.addError(this, t); return; } } } }
From source file:org.apache.myfaces.trinidadinternal.renderkit.RenderKitTestCase.java
@Override public void run(TestResult result) { try {/*from w ww . j a va 2s . c o m*/ setUp(); super.run(result); tearDown(); } catch (Exception e) { result.addError(this, e); } }
From source file:org.eclipse.gemini.blueprint.test.internal.support.OsgiJUnitService.java
/** * Run fixture setup, test from the given test case and fixture teardown. * // ww w . j ava2 s . c o m * @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; }