Register now for Android Dev Summit 2019!

TestWorkerBuilder

public class TestWorkerBuilder
extends TestListenableWorkerBuilder<W extends Worker>

java.lang.Object
   ↳ androidx.work.testing.TestListenableWorkerBuilder<W extends androidx.work.Worker>
     ↳ androidx.work.testing.TestWorkerBuilder<W extends androidx.work.Worker>


Builds instances of Worker which can be used for testing.

Summary

Public methods

static TestWorkerBuilder<? extends Worker> from(Context context, WorkRequest workRequest, Executor executor)

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

static <W extends Worker> TestWorkerBuilder<W> from(Context context, Class<W> workerClass, Executor executor)

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

Inherited methods

Public methods

from

public static TestWorkerBuilder<? extends Worker> from (Context context, 
                WorkRequest workRequest, 
                Executor executor)

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<? extends Worker> The new instance of a TestWorkerBuilder

from

public static TestWorkerBuilder<W> from (Context context, 
                Class<W> workerClass, 
                Executor executor)

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<W> The new instance of a TestWorkerBuilder