Google は、黒人コミュニティに対する人種平等の促進に取り組んでいます。取り組みを見る

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.

TestListenableWorkerBuilder<W> setProgressUpdater(ProgressUpdater updater)

Sets the ProgressUpdater to be used to construct the ListenableWorker.

TestListenableWorkerBuilder<W> setRunAttemptCount(int runAttemptCount)

Sets the initial run attempt count for this work.

TestListenableWorkerBuilder<W> setTags(List<String> tags)

Sets the tags associated with this unit of work.

TestListenableWorkerBuilder<W> setTriggeredContentAuthorities(List<String> authorities)

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

TestListenableWorkerBuilder<W> setTriggeredContentUris(List<Uri> contentUris)

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

TestListenableWorkerBuilder<W> setWorkerFactory(WorkerFactory workerFactory)

Sets the WorkerFactory to be used to construct the ListenableWorker.

Inherited methods

Public methods

build

public W build ()

Builds the ListenableWorker.

Returns
W the instance of a ListenableWorker.

from

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

Creates a new instance of a TestListenableWorkerBuilder from a WorkRequest.

Parameters
context Context: The Context

workRequest WorkRequest: The WorkRequest

Returns
TestListenableWorkerBuilder<? extends ListenableWorker> The new instance of a ListenableWorker

from

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

Creates a new instance of a TestListenableWorkerBuilder the worker Class.

Parameters
context Context: The Context

workerClass Class: The subtype of ListenableWorker being built

Returns
TestListenableWorkerBuilder<W> The new instance of a ListenableWorker

setForegroundUpdater

public TestListenableWorkerBuilder<W> setForegroundUpdater (ForegroundUpdater updater)

Sets the ForegroundUpdater to be used to construct the ListenableWorker.

Parameters
updater ForegroundUpdater: The ForegroundUpdater which can handle notification updates.

Returns
TestListenableWorkerBuilder<W> The current TestListenableWorkerBuilder

setId

public TestListenableWorkerBuilder<W> setId (UUID id)

Sets the id for this unit of work.

Parameters
id UUID: The UUID

Returns
TestListenableWorkerBuilder<W> The current TestListenableWorkerBuilder

setInputData

public TestListenableWorkerBuilder<W> setInputData (Data inputData)

Adds input Data to the work.

Parameters
inputData Data: key/value pairs that will be provided to the worker

Returns
TestListenableWorkerBuilder<W> The current TestListenableWorkerBuilder

setNetwork

public TestListenableWorkerBuilder<W> setNetwork (Network network)

Sets the network associated with this unit of work.

Parameters
network Network: The Network associated with this unit of work

Returns
TestListenableWorkerBuilder<W> The current TestListenableWorkerBuilder

setProgressUpdater

public TestListenableWorkerBuilder<W> setProgressUpdater (ProgressUpdater updater)

Sets the ProgressUpdater to be used to construct the ListenableWorker.

Parameters
updater ProgressUpdater: The ProgressUpdater which can handle progress updates.

Returns
TestListenableWorkerBuilder<W> The current TestListenableWorkerBuilder

setRunAttemptCount

public TestListenableWorkerBuilder<W> setRunAttemptCount (int runAttemptCount)

Sets the initial run attempt count for this work.

Parameters
runAttemptCount int: The initial run attempt count

Returns
TestListenableWorkerBuilder<W> The current TestListenableWorkerBuilder

setTags

public TestListenableWorkerBuilder<W> setTags (List<String> tags)

Sets the tags associated with this unit of work.

Parameters
tags List: The List of tags to be used

Returns
TestListenableWorkerBuilder<W> The current TestListenableWorkerBuilder

setTriggeredContentAuthorities

public TestListenableWorkerBuilder<W> setTriggeredContentAuthorities (List<String> authorities)

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

Parameters
authorities List: The List of authorities

Returns
TestListenableWorkerBuilder<W> The current TestListenableWorkerBuilder

setTriggeredContentUris

public TestListenableWorkerBuilder<W> setTriggeredContentUris (List<Uri> contentUris)

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

Parameters
contentUris List: The list of content Uris

Returns
TestListenableWorkerBuilder<W> The current TestListenableWorkerBuilder

setWorkerFactory

public TestListenableWorkerBuilder<W> setWorkerFactory (WorkerFactory workerFactory)

Sets the WorkerFactory to be used to construct the ListenableWorker.

Parameters
workerFactory WorkerFactory: The WorkerFactory to use to construct the ListenableWorker

Returns
TestListenableWorkerBuilder<W> The current TestListenableWorkerBuilder