TestWorkerBuilder

open class TestWorkerBuilder<W : Worker!> : TestListenableWorkerBuilder<W>
kotlin.Any
   ↳ androidx.work.testing.TestListenableWorkerBuilder<W>
   ↳ androidx.work.testing.TestWorkerBuilder

Builds instances of Worker which can be used for testing.

Summary

Public methods

open static TestWorkerBuilder<out Worker!>
from(@NonNull context: Context, @NonNull workRequest: WorkRequest, @NonNull executor: Executor)

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

open static TestWorkerBuilder<W>
from(@NonNull context: Context, @NonNull workerClass: Class<W>, @NonNull executor: Executor)

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

Inherited functions

Public methods

from

@NonNull open static fun from(@NonNull context: Context, @NonNull workRequest: WorkRequest, @NonNull executor: Executor): TestWorkerBuilder<out Worker!>

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

Parameters
context Context: The Context
workRequest Context: The WorkRequest
executor Context: The Executor
Return
TestWorkerBuilder<out Worker!>: The new instance of a TestWorkerBuilder

from

@NonNull open static fun <W : Worker!> from(@NonNull context: Context, @NonNull workerClass: Class<W>, @NonNull executor: Executor): TestWorkerBuilder<W>

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

Parameters
context Context: The Context
workerClass Context: The subtype of Worker being built
executor Context: The Executor
Return
TestWorkerBuilder<W>: The new instance of a TestWorkerBuilder