TestDriver
public
interface
TestDriver
androidx.work.testing.TestDriver |
Additional functionality exposed for WorkManager
that are useful in the
context of testing.
Summary
Public methods | |
---|---|
abstract
void
|
setAllConstraintsMet(UUID workSpecId)
Tells |
abstract
void
|
setInitialDelayMet(UUID workSpecId)
Tells |
abstract
void
|
setPeriodDelayMet(UUID workSpecId)
Tells |
Public methods
setAllConstraintsMet
public abstract void setAllConstraintsMet (UUID workSpecId)
Tells TestDriver
to pretend that all constraints on the
WorkRequest
with the given workSpecId
are met. This may
trigger execution of the work.
Parameters | |
---|---|
workSpecId |
UUID : The WorkRequest 's id |
Throws | |
---|---|
IllegalArgumentException |
if workSpecId is not enqueued
|
setInitialDelayMet
public abstract void setInitialDelayMet (UUID workSpecId)
Tells TestDriver
to pretend that the initial delay the
OneTimeWorkRequest
with the given workSpecId
is met. This may
trigger execution of the work.
Parameters | |
---|---|
workSpecId |
UUID : The OneTimeWorkRequest 's id |
Throws | |
---|---|
IllegalArgumentException |
if workSpecId is not enqueued
|
setPeriodDelayMet
public abstract void setPeriodDelayMet (UUID workSpecId)
Tells TestDriver
to pretend that the period delay on the
PeriodicWorkRequest
with the given workSpecId
is met. This may
trigger execution of the work.
Parameters | |
---|---|
workSpecId |
UUID : The PeriodicWorkRequest 's id |
Throws | |
---|---|
IllegalArgumentException |
if workSpecId is not enqueued
|