Component used: android.arch.work:work-testing:1.0.0-alpha04 Devices/Android versions reproduced on: Google Pixel, P DP4
As presently implemented, setAllConstraintsMet() needs to be called *after* the work is enqueued in WorkManager. If you call setAllConstraintsMet() before the call to enqueue(), the subsequent enqueue() call returns immediately without actually executing the work.
Ideally, the order of events here should not matter -- we should be able to call setAllConstraintsMet() before or after enqueuing the work, particularly when using the SynchronousExecutor. However, if there are technical reasons why the work needs to be enqueued first before setAllConstraintsMet() is called, the documentation should be much plainer about that order-of-execution requirement.
Description
Devices/Android versions reproduced on: Google Pixel, P DP4
As presently implemented, setAllConstraintsMet() needs to be called *after* the work is enqueued in WorkManager. If you call setAllConstraintsMet() before the call to enqueue(), the subsequent enqueue() call returns immediately without actually executing the work.
Ideally, the order of events here should not matter -- we should be able to call setAllConstraintsMet() before or after enqueuing the work, particularly when using the SynchronousExecutor. However, if there are technical reasons why the work needs to be enqueued first before setAllConstraintsMet() is called, the documentation should be much plainer about that order-of-execution requirement.
Thanks!