TestWorkerBuilder
public class TestWorkerBuilder<W extends Worker> extends TestListenableWorkerBuilder
| java.lang.Object | ||
| ↳ | androidx.work.testing.TestListenableWorkerBuilder | |
| ↳ | androidx.work.testing.TestWorkerBuilder |
Builds instances of Worker which can be used for testing.
Summary
Public methods |
|
|---|---|
static @NonNull TestWorkerBuilder<Worker> |
Creates a new instance of a |
static @NonNull TestWorkerBuilder<W> |
<W extends Worker> from(Creates a new instance of a |
Public methods
from
public static @NonNull TestWorkerBuilder<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.
| Parameters | |
|---|---|
@NonNull Context context |
The |
@NonNull WorkRequest workRequest |
The |
@NonNull Executor executor |
The |
| Returns | |
|---|---|
@NonNull TestWorkerBuilder<Worker> |
The new instance of a |
from
public static @NonNull TestWorkerBuilder<W> <W extends Worker> from(
@NonNull Context context,
@NonNull Class<W> workerClass,
@NonNull Executor executor
)
Creates a new instance of a TestWorkerBuilder with the worker Class that runs on the given Executor.
| Parameters | |
|---|---|
@NonNull Context context |
The |
@NonNull Class<W> workerClass |
The subtype of |
@NonNull Executor executor |
The |
| Returns | |
|---|---|
@NonNull TestWorkerBuilder<W> |
The new instance of a |