|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jmock.lib.concurrent.DeterministicExecutor
public class DeterministicExecutor
An Executor
that executes commands on the thread that calls
runPendingCommands
or runUntilIdle
.
This is useful when using Mock Objects to test code that spawns background tasks.
Constructor Summary | |
---|---|
DeterministicExecutor()
|
Method Summary | |
---|---|
void |
execute(Runnable command)
|
boolean |
isIdle()
Returns whether this executor is idle -- has no pending background tasks waiting to be run. |
void |
runPendingCommands()
Runs all commands that are currently pending. |
void |
runUntilIdle()
Runs executed commands until there are no commands pending execution, but does not tick time forward. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DeterministicExecutor()
Method Detail |
---|
public boolean isIdle()
runPendingCommands()
,
runUntilIdle()
public void runPendingCommands()
runPendingCommands()
or
runUntilIdle()
.
public void runUntilIdle()
public void execute(Runnable command)
execute
in interface Executor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |