public static class JUnitExtensions.MultiThreadedTestCase
extends junit.framework.TestCase
MultiThreadedTestCase
Runnable extend MultiThreadedTestCase.TestCaseRunnable.
runTestCase () to do your test, you may call fail (), assert () etc. and throw
exceptions with impunity.
runTestCaseRunnables ().
public class MTTest extends JUnitExtensions.MultiThreadedTestCase
{
MTTest (String s) { super (s); }
public class CounterThread extends JUnitExtensions.TestCaseRunnable
{
public void runTestCase () throws Throwable
{
for (int i = 0; i < 1000; i++)
{
System.out.println ("Counter Thread: " + Thread.currentThread () + " : " + i);
// Do some testing...
if (Thread.currentThread ().isInterrupted ()) {
return;
}
}
}
}
public void test1 ()
{
TestCaseRunnable tct [] = new TestCaseRunnable [5];
for (int i = 0; i < 5; i++)
{
tct[i] = new CounterThread ();
}
runTestCaseRunnables (tct);
}
}
| Constructor and Description |
|---|
JUnitExtensions.MultiThreadedTestCase(java.lang.String s)
Simple constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
interruptThreads()
Interrupt the running threads.
|
void |
run(junit.framework.TestResult result)
Override run so we can squirrel away the test result.
|
countTestCases, getName, run, runBare, setName, toStringassertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSamepublic JUnitExtensions.MultiThreadedTestCase(java.lang.String s)
public void interruptThreads()
public void run(junit.framework.TestResult result)
run in interface junit.framework.Testrun in class junit.framework.TestCase(C) 2002 - 2005 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30