diff options
author | wisberg <wisberg> | 2005-06-09 15:57:10 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2005-06-09 15:57:10 +0000 |
commit | 6b4238eb0f0871eae60d71fe596c96c2ae5dce76 (patch) | |
tree | 7757f5e169ad0e12fa4401864dee398e4035bdbb /testing/newsrc/org/aspectj | |
parent | e0e3389181b6ca1a88ed12e988abd4d4eb533ddd (diff) | |
download | aspectj-6b4238eb0f0871eae60d71fe596c96c2ae5dce76.tar.gz aspectj-6b4238eb0f0871eae60d71fe596c96c2ae5dce76.zip |
unused imports (only)
Diffstat (limited to 'testing/newsrc/org/aspectj')
-rw-r--r-- | testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java index 7db54e005..22cb30338 100644 --- a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java +++ b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java @@ -16,6 +16,7 @@ import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; +import java.util.Stack; import junit.extensions.TestSetup; import junit.framework.Test; @@ -39,6 +40,7 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase { private static Map testMap = new HashMap(); private static boolean suiteLoaded = false; private AjcTest currentTest = null; + private Stack clearTestAfterRun = new Stack(); public XMLBasedAjcTestCase() { } @@ -96,11 +98,20 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase { */ protected void runTest(String title) { currentTest = (AjcTest) testMap.get(title); + final boolean clearTest = clearTestAfterRun(); if (currentTest == null) { - fail("No test '" + title + "' in suite."); - } + if (clearTest) { + System.err.println("test already run: " + title); + return; + } else { + fail("No test '" + title + "' in suite."); + } + } ajc.setShouldEmptySandbox(true); currentTest.runTest(this); + if (clearTest) { + testMap.remove(title); + } } /** @@ -119,6 +130,25 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase { public void addTest(AjcTest test) { testMap.put(test.getTitle(),test); } + protected final void pushClearTestAfterRun(boolean val) { + clearTestAfterRun.push(val ? Boolean.FALSE: Boolean.TRUE); + } + protected final boolean popClearTestAfterRun() { + return clearTest(true); + } + protected final boolean clearTestAfterRun() { + return clearTest(false); + } + private boolean clearTest(boolean pop) { + if (clearTestAfterRun.isEmpty()) { + return false; + } + boolean result = ((Boolean) clearTestAfterRun.peek()).booleanValue(); + if (pop) { + clearTestAfterRun.pop(); + } + return result; + } /* * The rules for parsing a suite spec file. The Digester using bean properties to match attributes |