public class ThreadedTestGroup
extends java.lang.ThreadGroup
ThreadedTestGroup
is a ThreadGroup
that catches and handles exceptions thrown by threads created
and started by ThreadedTest
instances.
If a thread managed by a ThreadedTestGroup
throws
an uncaught exception, then the exception is added to the current
test's results and all other threads are immediately interrupted.
Constructor and Description |
---|
ThreadedTestGroup(junit.framework.Test test)
Constructs a
ThreadedTestGroup for the
specified test. |
Modifier and Type | Method and Description |
---|---|
void |
setTestResult(junit.framework.TestResult result)
Sets the current test result.
|
void |
uncaughtException(java.lang.Thread t,
java.lang.Throwable e)
Called when a thread in this thread group stops because of
an uncaught exception.
|
activeCount, activeGroupCount, allowThreadSuspension, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, parentOf, resume, setDaemon, setMaxPriority, stop, suspend, toString
public ThreadedTestGroup(junit.framework.Test test)
ThreadedTestGroup
for the
specified test.test
- Current test.public void setTestResult(junit.framework.TestResult result)
result
- Test result.public void uncaughtException(java.lang.Thread t, java.lang.Throwable e)
If the uncaught exception is a ThreadDeath
,
then it is ignored. If the uncaught exception is an
AssertionFailedError
, then a failure
is added to the current test's result. Otherwise, an
error is added to the current test's result.
uncaughtException
in interface java.lang.Thread.UncaughtExceptionHandler
uncaughtException
in class java.lang.ThreadGroup
t
- Originating thread.e
- Uncaught exception.Copyright ? 1999-2005 Clarkware Consulting, Inc.