work/workmanager-test/src/main/java/androidx/work/test/WorkManagerTestInitHelper.java
public static void initializeTestWorkManager(
            @NonNull Context context,
            @NonNull Configuration configuration) {

        setupSynchronousTaskExecutor();
        final TestScheduler scheduler = new TestScheduler();
        WorkManagerImpl workManager = new TestWorkManagerImpl(context, configuration) {
            @NonNull
            @Override
            public List<Scheduler> getSchedulers() {
                return Collections.singletonList((Scheduler) scheduler);
            }

            @Override
            public void setAllConstraintsMet(@NonNull UUID workSpecId) {
                scheduler.setAllConstraintsMet(workSpecId);
            }
        };
        workManager.getProcessor().addExecutionListener(scheduler);
        WorkManagerImpl.setDelegate(workManager);
    }
/**
     * Initializes a test {@link androidx.work.WorkManager} with a user-specified
     * {@link androidx.work.Configuration}.
     *
     * @param context The application {@link Context}
     * @param configuration The {@link androidx.work.Configuration}
     */


@param context The application  Context
@param configuration The  androidx.work.Configuration
@param context The application Context @param configuration The androidx . work . Configuration
public static void initializeTestWorkManager(
            @NonNull Context context,
            @NonNull Configuration configuration) {
        setupSynchronousTaskExecutor();
        final TestScheduler scheduler = new TestScheduler();
        WorkManagerImpl workManager = new TestWorkManagerImpl(context, configuration) {
            @NonNull
            @Override
            public List<Scheduler> getSchedulers() {
                return Collections.singletonList((Scheduler) scheduler);
            }
            @Override
            public void setAllConstraintsMet(@NonNull UUID workSpecId) {
                scheduler.setAllConstraintsMet(workSpecId);
            }
        };
        workManager.getProcessor().addExecutionListener(scheduler);
        WorkManagerImpl.setDelegate(workManager);
    }
public static void initializeTestWorkManager ( @ NonNull Context context , @ NonNull Configuration configuration ) { setupSynchronousTaskExecutor ( ) ; final TestScheduler scheduler = new TestScheduler ( ) ; WorkManagerImpl workManager = new TestWorkManagerImpl ( context , configuration ) { @ NonNull @ Override public List < Scheduler > getSchedulers ( ) { return Collections . singletonList ( ( Scheduler ) scheduler ) ; } @ Override public void setAllConstraintsMet ( @ NonNull UUID workSpecId ) { scheduler . setAllConstraintsMet ( workSpecId ) ; } } ; workManager . getProcessor ( ) . addExecutionListener ( scheduler ) ; WorkManagerImpl . setDelegate ( workManager ) ; }
Initializes a test {@link androidx.work.WorkManager} with a user-specified
 {@link androidx.work.Configuration}.
Initializes a test { @link androidx . work . WorkManager } with a user - specified { @link androidx . work . Configuration } .