com.google.testing.threadtester
Class SecondaryRunnableImpl<T,M extends MainRunnable<T>>
java.lang.Object
com.google.testing.threadtester.SecondaryRunnableImpl<T,M>
- Type Parameters:
T - the type under test. It is expected that the runnable will invoke a
method on this class.M - the typed MainRunnable corresponding to this secondary runnable.
- All Implemented Interfaces:
- SecondaryRunnable<T,M>, ThrowingRunnable
public abstract class SecondaryRunnableImpl<T,M extends MainRunnable<T>>
- extends Object
- implements SecondaryRunnable<T,M>
Implementation of SecondaryRunnable with empty methods. Provided as a
convenience class, so that subclasses only need to implement the methods that
they need. Note that the implementation of canBlock() returns true.
- Author:
- alasdair.mackintosh@gmail.com (Alasdair Mackintosh)
|
Method Summary |
boolean |
canBlock()
Implements canBlock(). |
void |
initialize(M main)
Invoked by the framework before running this runnable. |
void |
terminate()
Invoked by the framework after running this runnable. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SecondaryRunnableImpl
public SecondaryRunnableImpl()
initialize
public void initialize(M main)
throws Exception
- Description copied from interface:
SecondaryRunnable
- Invoked by the framework before running this runnable. This method will be
called once at the start of each interation. Any object creation or
initialization code can be placed here. Note that this method is invoked
after the initialize method of the corresponding
MainRunnable. Any
exceptions thrown will be passed back to the caller of InterleavedRunner.interleave(M, com.google.testing.threadtester.SecondaryRunnable).
- Specified by:
initialize in interface SecondaryRunnable<T,M extends MainRunnable<T>>
- Throws:
Exception
terminate
public void terminate()
throws Exception
- Description copied from interface:
SecondaryRunnable
- Invoked by the framework after running this runnable. Any test verification
code can be placed here. Note that any exceptions thrown will be passed back
to the caller of
InterleavedRunner.interleave(M, com.google.testing.threadtester.SecondaryRunnable).
- Specified by:
terminate in interface SecondaryRunnable<T,M extends MainRunnable<T>>
- Throws:
Exception- See Also:
RunResult
canBlock
public boolean canBlock()
- Implements
canBlock().
- Specified by:
canBlock in interface SecondaryRunnable<T,M extends MainRunnable<T>>
- Returns:
- true. Subclasses should override this if necessary, although in
most cases it is correct for the secondary runnable to block if the main
runnable is in a synchronized method.
Copyright © 2013. All Rights Reserved.