/*
 * Copyright 2016 Peter Kenji Yamanaka
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.pyamsoft.padlock.dagger;

import android.content.Context;
import android.support.annotation.NonNull;
import com.birbit.android.jobqueue.JobManager;
import com.pyamsoft.padlock.PadLockPreferences;
import dagger.Module;
import dagger.Provides;
import javax.inject.Named;
import org.mockito.Mockito;
import rx.Scheduler;
import rx.schedulers.Schedulers;

@Module public class TestPadLockModule {

  @NonNull private final Context appContext;

  public TestPadLockModule(@NonNull Context context) {
    this.appContext = context.getApplicationContext();
  }

  @Provides Context provideContext() {
    return appContext;
  }

  @Named("io") @Provides Scheduler provideIOScheduler() {
    return Schedulers.immediate();
  }

  @Named("main") @Provides Scheduler provideMainThreadScheduler() {
    return Schedulers.immediate();
  }

  @Provides PadLockPreferences providePreferences() {
    final PadLockPreferences mockPreferences = Mockito.mock(PadLockPreferences.class);
    return mockPreferences;
  }

  @Provides JobManager provideJobManager() {
    // KLUDGE Should not really be mocking this, we dont own it
    final JobManager mockJobManager = Mockito.mock(JobManager.class);
    return mockJobManager;
  }

  @Provides PadLockDB providePadLockDB() {
    final PadLockDB mockPadLockDB = Mockito.mock(PadLockDB.class);
    return mockPadLockDB;
  }
}

@@ -802,24 +802,87 @@
 references;%0A
+import com.pyamsoft.padlock.dagger.wrapper.JobSchedulerCompat;%0A
 import dagge
@@ -1694,33 +1694,49 @@
  Job
-Manager provideJobManager
+SchedulerCompat provideJobSchedulerCompat
 () %7B
@@ -1817,30 +1817,46 @@
  Job
-Manager mockJobManager
+SchedulerCompat mockJobSchedulerCompat
  = M
@@ -1870,23 +1870,31 @@
 mock(Job
-Manager
+SchedulerCompat
 .class);
@@ -1912,23 +1912,31 @@
  mockJob
-Manager
+SchedulerCompat
 ;%0A  %7D%0A%0A 

Update test