TestWorkerBuilder


class TestWorkerBuilderWorker?> : TestListenableWorkerBuilder

Builds instances of Worker which can be used for testing.

Parameters
Worker?>

The actual subtype of Worker

Summary

Public functions

java-static TestWorkerBuilder<Worker!>
from(context: Context, workRequest: WorkRequest, executor: Executor)

Creates a new instance of a TestWorkerBuilder from a WorkRequest that runs on the given Executor.

java-static TestWorkerBuilder
Worker?> from(context: Context, workerClass: Class, executor: Executor)

Creates a new instance of a TestWorkerBuilder with the worker Class that runs on the given Executor.

Inherited functions

From androidx.work.testing.TestListenableWorkerBuilder
W

Builds the ListenableWorker.

java-static TestListenableWorkerBuilder<ListenableWorker!>
from(context: Context, workRequest: WorkRequest)

Creates a new instance of a TestListenableWorkerBuilder from a WorkRequest.

java-static TestListenableWorkerBuilder
ListenableWorker?> from(context: Context, workerClass: Class)

Creates a new instance of a TestListenableWorkerBuilder the worker Class.

TestListenableWorkerBuilder

Sets the ForegroundUpdater to be used to construct the androidx.work.ListenableWorker.

TestListenableWorkerBuilder
setId(id: UUID)

Sets the id for this unit of work.

TestListenableWorkerBuilder
setInputData(inputData: Data)

Adds input Data to the work.

TestListenableWorkerBuilder
@RequiresApi(value = 28)
setNetwork(network: Network)

Sets the network associated with this unit of work.

TestListenableWorkerBuilder

Sets the ProgressUpdater to be used to construct the androidx.work.ListenableWorker.

TestListenableWorkerBuilder
setRunAttemptCount(runAttemptCount: Int)

Sets the initial run attempt count for this work.

TestListenableWorkerBuilder

Sets the tags associated with this unit of work.

TestListenableWorkerBuilder

Sets the authorities for content Uri's associated with this unit of work.

TestListenableWorkerBuilder
@RequiresApi(value = 24)
setTriggeredContentUris(contentUris: (Mutable)List<Uri!>)

Sets the list of Content Uris associated with this unit of work.

TestListenableWorkerBuilder

Sets the WorkerFactory to be used to construct the androidx.work.ListenableWorker.

Public functions

from

Added in 2.1.0
java-static fun from(context: Context, workRequest: WorkRequest, executor: Executor): TestWorkerBuilder<Worker!>

Creates a new instance of a TestWorkerBuilder from a WorkRequest that runs on the given Executor.

Parameters
context: Context

The Context

workRequest: WorkRequest

The WorkRequest

executor: Executor

The Executor

Returns
TestWorkerBuilder<Worker!>

The new instance of a TestWorkerBuilder

from

Added in 2.1.0
java-static fun Worker?> from(context: Context, workerClass: Class, executor: Executor): TestWorkerBuilder

Creates a new instance of a TestWorkerBuilder with the worker Class that runs on the given Executor.

Parameters
context: Context

The Context

workerClass: Class

The subtype of Worker being built

executor: Executor

The Executor

Returns
TestWorkerBuilder

The new instance of a TestWorkerBuilder