diff options
author | Eike Stepper | 2012-10-07 07:16:20 +0000 |
---|---|---|
committer | Eike Stepper | 2012-10-07 07:16:20 +0000 |
commit | ad9be42fed20da84e2d01965026052f238a6fc41 (patch) | |
tree | 09e4d6e58d9940331ed41ea92652eb06483180a1 /plugins/org.eclipse.net4j.tests | |
parent | 3d0c7825e4216580e2cff1f857d44bae27acd3e0 (diff) | |
download | cdo-ad9be42fed20da84e2d01965026052f238a6fc41.tar.gz cdo-ad9be42fed20da84e2d01965026052f238a6fc41.tar.xz cdo-ad9be42fed20da84e2d01965026052f238a6fc41.zip |
Make current test instance available globally during tests
Diffstat (limited to 'plugins/org.eclipse.net4j.tests')
-rw-r--r-- | plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java | 87 |
1 files changed, 50 insertions, 37 deletions
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java index 483ecb774e..90cbd802ee 100644 --- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java +++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java @@ -10,6 +10,7 @@ */ package org.eclipse.net4j.util.tests; +import org.eclipse.net4j.internal.util.test.TestExecuter; import org.eclipse.net4j.tests.bundle.OM; import org.eclipse.net4j.util.ReflectUtil; import org.eclipse.net4j.util.concurrent.ConcurrencyUtil; @@ -242,53 +243,60 @@ public abstract class AbstractOMTest extends TestCase @Override public void runBare() throws Throwable { - try + TestExecuter.execute(this, new TestExecuter.Executable() { - // Don't call super.runBare() because it does not clean up after exceptions from setUp() - Throwable exception = null; - - try - { - setUp(); - runTest(); - } - catch (Throwable running) - { - exception = running; - } - finally + public void execute() throws Throwable { try { - tearDown(); + Throwable exception = null; + + try + { + setUp(); + + // Don't call super.runBare() because it does not clean up after exceptions from setUp() + runTest(); + } + catch (Throwable running) + { + exception = running; + } + finally + { + try + { + tearDown(); + } + catch (Throwable tearingDown) + { + if (exception == null) + { + exception = tearingDown; + } + } + } + + if (exception != null) + { + throw exception; + } + } + catch (SkipTestException ex) + { + OM.LOG.info("Skipped " + this); //$NON-NLS-1$ } - catch (Throwable tearingDown) + catch (Throwable t) { - if (exception == null) + if (!SUPPRESS_OUTPUT) { - exception = tearingDown; + t.printStackTrace(IOUtil.OUT()); } - } - } - if (exception != null) - { - throw exception; - } - } - catch (SkipTestException ex) - { - OM.LOG.info("Skipped " + this); //$NON-NLS-1$ - } - catch (Throwable t) - { - if (!SUPPRESS_OUTPUT) - { - t.printStackTrace(IOUtil.OUT()); + throw t; + } } - - throw t; - } + }); } @Override @@ -422,6 +430,11 @@ public abstract class AbstractOMTest extends TestCase return file; } + public static AbstractOMTest getCurrrentTest() + { + return (AbstractOMTest)TestExecuter.getValue(); + } + /** * @deprecated Use assertEquals(message, true, ...) */ |