|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
com.google.testing.threadtester.TestThread
public class TestThread
Implementation of Thread that catches and stores any Exception thrown by the
Thread.run() method.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary |
|---|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
TestThread(Runnable target,
String name)
Creates a new TestThread that executes the given Runnable. |
|
TestThread(String name)
Creates a new TestThread with the given name. |
|
TestThread(ThrowingRunnable target,
String name)
Creates a new TestThread that executes the given TestRunnable. |
|
| Method Summary | |
|---|---|
void |
finish()
Waits for this thread to finish. |
Throwable |
getException()
Gets the Throwable thrown by the Thread.run() method, or null if there
is no such exception. |
void |
throwExceptionsIfAny()
Rethrows the Throwable thrown by the Thread.run() method, wrapped in a
RuntimeException if necessary. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TestThread(Runnable target,
String name)
public TestThread(ThrowingRunnable target,
String name)
ThrowingRunnable.run() method
is invoked will be caught.
public TestThread(String name)
| Method Detail |
|---|
public void finish()
throws InterruptedException,
TestTimeoutException
Options.timeout. Throws an IllegalStateException if this thread has not
terminated by the specified time.
InterruptedException
TestTimeoutExceptionpublic Throwable getException()
Thread.run() method, or null if there
is no such exception.
public void throwExceptionsIfAny()
Thread.run() method, wrapped in a
RuntimeException if necessary. If there was no exception thrown, does
nothing.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||