Join us on the livestream at Android Dev Summit on 7-8 November 2018, starting at 10AM PDT!

WorkManagerTestInitHelper

public final class WorkManagerTestInitHelper
extends Object

java.lang.Object
   ↳ androidx.work.testing.WorkManagerTestInitHelper


Helps initialize WorkManager for testing.

Summary

Public methods

static TestDriver getTestDriver()
static void initializeTestWorkManager(Context context)

Initializes a test WorkManager with a SynchronousExecutor.

static void initializeTestWorkManager(Context context, Configuration configuration)

Initializes a test WorkManager with a user-specified Configuration.

Inherited methods

Public methods

getTestDriver

public static TestDriver getTestDriver ()

Returns
TestDriver An instance of TestDriver. This exposes additional functionality that is useful in the context of testing when using WorkManager.

initializeTestWorkManager

public static void initializeTestWorkManager (Context context)

Initializes a test WorkManager with a SynchronousExecutor.

Parameters
context Context: The application Context

initializeTestWorkManager

public static void initializeTestWorkManager (Context context, 
                Configuration configuration)

Initializes a test WorkManager with a user-specified Configuration.

Parameters
context Context: The application Context

configuration Configuration: The Configuration