public final class TestScheduler extends Scheduler
Scheduler.Worker
Constructor and Description |
---|
TestScheduler() |
Modifier and Type | Method and Description |
---|---|
void |
advanceTimeBy(long delayTime,
java.util.concurrent.TimeUnit unit)
Moves the Scheduler's clock forward by a specified amount of time.
|
void |
advanceTimeTo(long delayTime,
java.util.concurrent.TimeUnit unit)
Moves the Scheduler's clock to a particular moment in time.
|
Scheduler.Worker |
createWorker()
Retrieves or creates a new
Scheduler.Worker that represents serial execution of actions. |
long |
now(java.util.concurrent.TimeUnit unit)
Returns the 'current time' of the Scheduler in the specified time unit.
|
void |
triggerActions()
Triggers any actions that have not yet been triggered and that are scheduled to be triggered at or
before this Scheduler's present time.
|
clockDriftTolerance, scheduleDirect, scheduleDirect, schedulePeriodicallyDirect, shutdown, start, when
public long now(@NonNull java.util.concurrent.TimeUnit unit)
Scheduler
public void advanceTimeBy(long delayTime, java.util.concurrent.TimeUnit unit)
delayTime
- the amount of time to move the Scheduler's clock forwardunit
- the units of time that delayTime
is expressed inpublic void advanceTimeTo(long delayTime, java.util.concurrent.TimeUnit unit)
delayTime
- the point in time to move the Scheduler's clock tounit
- the units of time that delayTime
is expressed inpublic void triggerActions()
@NonNull public Scheduler.Worker createWorker()
Scheduler
Scheduler.Worker
that represents serial execution of actions.
When work is completed it should be unsubscribed using Disposable.dispose()
.
Work on a Scheduler.Worker
is guaranteed to be sequential.
createWorker
in class Scheduler