TestListenableWorkerBuilder

public class TestListenableWorkerBuilder
extends Object

java.lang.Object
   ↳ androidx.work.testing.TestListenableWorkerBuilder<W extends androidx.work.ListenableWorker>


Builds instances of ListenableWorker which can be used for testing.

Summary

Public methods

W build()

Builds the ListenableWorker.

static TestListenableWorkerBuilder<? extends ListenableWorker> from(Context context, WorkRequest workRequest)

Creates a new instance of a TestListenableWorkerBuilder from a WorkRequest.

static <W extends ListenableWorker> TestListenableWorkerBuilder<W> from(Context context, Class<W> workerClass)

Creates a new instance of a TestListenableWorkerBuilder the worker Class.

TestListenableWorkerBuilder<W> setForegroundUpdater(ForegroundUpdater updater)

Sets the ForegroundUpdater to be used to construct the ListenableWorker.

TestListenableWorkerBuilder<W> setId(UUID id)

Sets the id for this unit of work.

TestListenableWorkerBuilder<W> setInputData(Data inputData)

Adds input Data to the work.

TestListenableWorkerBuilder<W> setNetwork(Network network)

Sets the network associated with this unit of work.