|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.ojb.junit.JUnitExtensions.MultiThreadedTestCase
public static class JUnitExtensions.MultiThreadedTestCase
A multi-threaded JUnit test case. To perform test cases that spin off threads to do tests:
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 Summary | |
|---|---|
JUnitExtensions.MultiThreadedTestCase(java.lang.String s)
Simple constructor. |
|
| Method Summary | |
|---|---|
void |
interruptThreads()
Interrupt the running threads. |
void |
run(junit.framework.TestResult result)
Override run so we can squirrel away the test result. |
| Methods inherited from class junit.framework.TestCase |
|---|
countTestCases, getName, run, runBare, setName, toString |
| Methods inherited from class junit.framework.Assert |
|---|
assertEquals, 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 |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JUnitExtensions.MultiThreadedTestCase(java.lang.String s)
| Method Detail |
|---|
public void interruptThreads()
public void run(junit.framework.TestResult result)
run in interface junit.framework.Testrun in class junit.framework.TestCase
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||