TestListenableWorkerBuilder
open class TestListenableWorkerBuilder<W : ListenableWorker!>
kotlin.Any | |
↳ | androidx.work.testing.TestListenableWorkerBuilder |
Builds instances of androidx.work.ListenableWorker
which can be used for testing.
Summary
Public methods | |
---|---|
open W |
build() Builds the |
open static TestListenableWorkerBuilder<out ListenableWorker!> |
from(@NonNull context: Context, @NonNull workRequest: WorkRequest) Creates a new instance of a |
open static TestListenableWorkerBuilder<W> |
Creates a new instance of a |
open TestListenableWorkerBuilder<W> |
setForegroundUpdater(@NonNull updater: ForegroundUpdater) Sets the |
open TestListenableWorkerBuilder<W> |
Sets the id for this unit of work. |
open TestListenableWorkerBuilder<W> |
setInputData(@NonNull inputData: Data) Adds input |
open TestListenableWorkerBuilder<W> |
setNetwork(@NonNull network: Network) Sets the network associated with this unit of work. |
open TestListenableWorkerBuilder<W> |
setProgressUpdater(@NonNull updater: ProgressUpdater) Sets the |
open TestListenableWorkerBuilder<W> |
setRunAttemptCount(runAttemptCount: Int) Sets the initial run attempt count for this work. |
open TestListenableWorkerBuilder<W> |
setTags(@NonNull tags: MutableList<String!>) Sets the tags associated with this unit of work. |
open TestListenableWorkerBuilder<W> |
setTriggeredContentAuthorities(@NonNull authorities: MutableList<String!>) Sets the authorities for content |
open TestListenableWorkerBuilder<W> |
setTriggeredContentUris(@NonNull contentUris: MutableList<Uri!>) Sets the list of Content |
open TestListenableWorkerBuilder<W> |
setWorkerFactory(@NonNull workerFactory: WorkerFactory) Sets the |
Public methods
build
@NonNull open fun build(): W
Builds the ListenableWorker
.
Return | |
---|---|
W |
the instance of a ListenableWorker . |
from
@NonNull open static fun from(
@NonNull context: Context,
@NonNull workRequest: WorkRequest
): TestListenableWorkerBuilder<out ListenableWorker!>
Creates a new instance of a TestListenableWorkerBuilder
from a WorkRequest
.
Parameters | |
---|---|
context |
Context: The Context |
workRequest |
WorkRequest: The WorkRequest |
Return | |
---|---|
TestListenableWorkerBuilder<out ListenableWorker!> |
The new instance of a ListenableWorker |
from
@NonNull open static fun <W : ListenableWorker!> from(
@NonNull context: Context,
@NonNull workerClass: Class<W>
): TestListenableWorkerBuilder<W>
Creates a new instance of a TestListenableWorkerBuilder
the worker Class
.
Parameters | |
---|---|
context |
Context: The Context |
workerClass |
Class<W>: The subtype of ListenableWorker being built |
Return | |
---|---|
TestListenableWorkerBuilder<W> |
The new instance of a ListenableWorker |
setForegroundUpdater
@NonNull open fun setForegroundUpdater(@NonNull updater: ForegroundUpdater): TestListenableWorkerBuilder<W>
Sets the ForegroundUpdater
to be used to construct the androidx.work.ListenableWorker
.
Parameters | |
---|---|
updater |
ForegroundUpdater: The ForegroundUpdater which can handle notification updates. |
Return | |
---|---|
TestListenableWorkerBuilder<W> |
The current TestListenableWorkerBuilder |
setId
@NonNull open fun setId(@NonNull id: UUID): TestListenableWorkerBuilder<W>
Sets the id for this unit of work.
Parameters | |
---|---|
id |
UUID: The UUID |
Return | |
---|---|
TestListenableWorkerBuilder<W> |
The current TestListenableWorkerBuilder |
setInputData
@NonNull open fun setInputData(@NonNull inputData: Data): TestListenableWorkerBuilder<W>
Adds input Data
to the work.
Parameters | |
---|---|
inputData |
Data: key/value pairs that will be provided to the worker |
Return | |
---|---|
TestListenableWorkerBuilder<W> |
The current TestListenableWorkerBuilder |
setNetwork
@RequiresApi(28) @NonNull open fun setNetwork(@NonNull network: Network): TestListenableWorkerBuilder<W>
Sets the network associated with this unit of work.
Parameters | |
---|---|
network |
Network: The Network associated with this unit of work |
Return | |
---|---|
TestListenableWorkerBuilder<W> |
The current TestListenableWorkerBuilder |
setProgressUpdater
@NonNull open fun setProgressUpdater(@NonNull updater: ProgressUpdater): TestListenableWorkerBuilder<W>
Sets the ProgressUpdater
to be used to construct the androidx.work.ListenableWorker
.
Parameters | |
---|---|
updater |
ProgressUpdater: The ProgressUpdater which can handle progress updates. |
Return | |
---|---|
TestListenableWorkerBuilder<W> |
The current TestListenableWorkerBuilder |
setRunAttemptCount
@NonNull open fun setRunAttemptCount(runAttemptCount: Int): TestListenableWorkerBuilder<W>
Sets the initial run attempt count for this work.
Parameters | |
---|---|
runAttemptCount |
Int: The initial run attempt count |
Return | |
---|---|
TestListenableWorkerBuilder<W> |
The current TestListenableWorkerBuilder |
setTags
@NonNull open fun setTags(@NonNull tags: MutableList<String!>): TestListenableWorkerBuilder<W>
Sets the tags associated with this unit of work.
Parameters | |
---|---|
tags |
MutableList<String!>: The List of tags to be used |
Return | |
---|---|
TestListenableWorkerBuilder<W> |
The current TestListenableWorkerBuilder |
setTriggeredContentAuthorities
@RequiresApi(24) @NonNull open fun setTriggeredContentAuthorities(@NonNull authorities: MutableList<String!>): TestListenableWorkerBuilder<W