Executor
public class DeterministicExecutor extends Object implements Executor
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 | Description |
---|---|
DeterministicExecutor() |
Modifier and Type | Method | Description |
---|---|---|
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.
|
public boolean isIdle()
runPendingCommands()
,
runUntilIdle()
public void runPendingCommands()
runPendingCommands()
or
runUntilIdle()
.public void runUntilIdle()
Copyright © 2003–2018 jMock. All rights reserved.