// Path: app/src/test/java/com/daksh/tmdbsample/app/TestTmdbApplication.java
// public class TestTmdbApplication extends TmdbApplication {
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         TestInjector.INSTANCE.initializeAppComponent(this).inject(this);
//     }
// }
// 
// Path: app/src/test/java/com/daksh/tmdbsample/di/component/TestAppComponent.java
// @Singleton
// @Component(modules = {
//         TestAppModule.class,
//         NetworkModule.class,
//         StorageModule.class
// })
// public interface TestAppComponent extends AppComponent {
// 
//     void inject(TestTmdbApplication testTmdbApplication);
// 
//     void inject(MovieListPresenterTest movieListPresenterTest);
// }
// 
// Path: app/src/main/java/com/daksh/tmdbsample/di/module/NetworkModule.java
// @Module
// public class NetworkModule {
// 
//     private static final int TIMEOUT = 60;
// 
//     private String baseUrl;
//     private String apiKey;
// 
//     public NetworkModule(String baseUrl, String apiKey) {
//         this.baseUrl = baseUrl;
//         this.apiKey = apiKey;
//     }
// 
//     @Provides
//     @Singleton
//     ApiKeyInsertionInterceptor provideApiKeyInterceptor() {
//         return new ApiKeyInsertionInterceptor(apiKey);
//     }
// 
//     @Provides
//     @Singleton
//     Locale provideLocale() {
//         return Locale.getDefault();
//     }
// 
//     @Provides
//     @Singleton
//     LanguageCodeInsertionInterceptor provideLanguageCodeInsertionInterceptor(Locale locale) {
//         return new LanguageCodeInsertionInterceptor(locale.getLanguage());
//     }
// 
//     @Provides
//     @Singleton
//     HttpLoggingInterceptor provideHttpLoggingInterceptor() {
//         return new HttpLoggingInterceptor(Logger::networkLog).setLevel(Level.BODY);
//     }
// 
//     @Provides
//     @Singleton
//     OkHttpClient provideOkHttpClient(ApiKeyInsertionInterceptor apiKeyInsertionInterceptor,
//             LanguageCodeInsertionInterceptor languageCodeInsertionInterceptor,
//             HttpLoggingInterceptor httpLoggingInterceptor) {
//         OkHttpClient.Builder builder = new OkHttpClient.Builder()
//                 .connectTimeout(TIMEOUT, TimeUnit.SECONDS)
//                 .readTimeout(TIMEOUT, TimeUnit.SECONDS)
//                 .writeTimeout(TIMEOUT, TimeUnit.SECONDS)
//                 .addInterceptor(apiKeyInsertionInterceptor)
//                 .addInterceptor(languageCodeInsertionInterceptor);
// 
//         if (BuildConfig.DEBUG) {
//             builder.addInterceptor(httpLoggingInterceptor);
//         }
// 
//         return builder.build();
//     }
// 
//     @Provides
//     @Singleton
//     Gson provideGson() {
//         return new GsonBuilder()
//                 .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
//                 .registerTypeAdapter(Date.class,
//                         (JsonDeserializer<Date>) (json, typeOfT, context) -> {
//                             try {
//                                 return Movie.DATE_FORMAT.parse(json.getAsString());
//                             } catch (ParseException e) {
//                                 return null;
//                             }
//                         })
//                 .create();
//     }
// 
//     @Provides
//     @Singleton
//     Retrofit provideRetrofit(OkHttpClient okHttpClient, Gson gson) {
//         return new Retrofit.Builder()
//                 .addConverterFactory(GsonConverterFactory.create(gson))
//                 .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
//                 .baseUrl(baseUrl)
//                 .client(okHttpClient)
//                 .build();
//     }
// 
//     @Provides
//     @Singleton
//     TmdbApi provideTmdbApi(Retrofit retrofit) {
//         return retrofit.create(TmdbApi.class);
//     }
// }
// 
// Path: app/src/test/java/com/daksh/tmdbsample/di/module/TestAppModule.java
// @Module
// public class TestAppModule {
// 
//     private final TestTmdbApplication application;
// 
//     public TestAppModule(TestTmdbApplication application) {
//         this.application = application;
//     }
// 
//     @Provides
//     @Singleton
//     Application provideApplication() {
//         return application;
//     }
// 
//     @Provides
//     @Singleton
//     Context provideContext() {
//         return application.getApplicationContext();
//     }
// }


import com.daksh.tmdbsample.BuildConfig;
import com.daksh.tmdbsample.app.TestTmdbApplication;
import com.daksh.tmdbsample.di.component.DaggerTestAppComponent;
import com.daksh.tmdbsample.di.component.TestAppComponent;
import com.daksh.tmdbsample.di.module.NetworkModule;
import com.daksh.tmdbsample.di.module.TestAppModule;
package com.daksh.tmdbsample.di;


/**
 * Created by daksh on 03-Sep-16.
 */
public enum TestInjector {

    INSTANCE;

    private TestAppComponent testAppComponent;

    public TestAppComponent initializeAppComponent(TestTmdbApplication application) {
        testAppComponent = DaggerTestAppComponent.builder()
                .testAppModule(new TestAppModule(application))
                .networkModule(new NetworkModule(BuildConfig.BASE_URL, BuildConfig.API_KEY))
                .build();

// Path: app/src/test/java/com/daksh/tmdbsample/app/TestTmdbApplication.java
// public class TestTmdbApplication extends TmdbApplication {
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         TestInjector.INSTANCE.initializeAppComponent(this).inject(this);
//     }
// }
// 
// Path: app/src/test/java/com/daksh/tmdbsample/di/component/TestAppComponent.java
// @Singleton
// @Component(modules = {
//         TestAppModule.class,
//         NetworkModule.class,
//         StorageModule.class
// })
// public interface TestAppComponent extends AppComponent {
// 
//     void inject(TestTmdbApplication testTmdbApplication);
// 
//     void inject(MovieListPresenterTest movieListPresenterTest);
// }
// 
// Path: app/src/main/java/com/daksh/tmdbsample/di/module/NetworkModule.java
// @Module
// public class NetworkModule {
// 
//     private static final int TIMEOUT = 60;
// 
//     private String baseUrl;
//     private String apiKey;
// 
//     public NetworkModule(String baseUrl, String apiKey) {
//         this.baseUrl = baseUrl;
//         this.apiKey = apiKey;
//     }
// 
//     @Provides
//     @Singleton
//     ApiKeyInsertionInterceptor provideApiKeyInterceptor() {
//         return new ApiKeyInsertionInterceptor(apiKey);
//     }
// 
//     @Provides
//     @Singleton
//     Locale provideLocale() {
//         return Locale.getDefault();
//     }
// 
//     @Provides
//     @Singleton
//     LanguageCodeInsertionInterceptor provideLanguageCodeInsertionInterceptor(Locale locale) {
//         return new LanguageCodeInsertionInterceptor(locale.getLanguage());
//     }
// 
//     @Provides
//     @Singleton
//     HttpLoggingInterceptor provideHttpLoggingInterceptor() {
//         return new HttpLoggingInterceptor(Logger::networkLog).setLevel(Level.BODY);
//     }
// 
//     @Provides
//     @Singleton
//     OkHttpClient provideOkHttpClient(ApiKeyInsertionInterceptor apiKeyInsertionInterceptor,
//             LanguageCodeInsertionInterceptor languageCodeInsertionInterceptor,
//             HttpLoggingInterceptor httpLoggingInterceptor) {
//         OkHttpClient.Builder builder = new OkHttpClient.Builder()
//                 .connectTimeout(TIMEOUT, TimeUnit.SECONDS)
//                 .readTimeout(TIMEOUT, TimeUnit.SECONDS)
//                 .writeTimeout(TIMEOUT, TimeUnit.SECONDS)
//                 .addInterceptor(apiKeyInsertionInterceptor)
//                 .addInterceptor(languageCodeInsertionInterceptor);
// 
//         if (BuildConfig.DEBUG) {
//             builder.addInterceptor(httpLoggingInterceptor);
//         }
// 
//         return builder.build();
//     }
// 
//     @Provides
//     @Singleton
//     Gson provideGson() {
//         return new GsonBuilder()
//                 .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
//                 .registerTypeAdapter(Date.class,
//                         (JsonDeserializer<Date>) (json, typeOfT, context) -> {
//                             try {
//                                 return Movie.DATE_FORMAT.parse(json.getAsString());
//                             } catch (ParseException e) {
//                                 return null;
//                             }
//                         })
//                 .create();
//     }
// 
//     @Provides
//     @Singleton
//     Retrofit provideRetrofit(OkHttpClient okHttpClient, Gson gson) {
//         return new Retrofit.Builder()
//                 .addConverterFactory(GsonConverterFactory.create(gson))
//                 .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
//                 .baseUrl(baseUrl)
//                 .client(okHttpClient)
//                 .build();
//     }
// 
//     @Provides
//     @Singleton
//     TmdbApi provideTmdbApi(Retrofit retrofit) {
//         return retrofit.create(TmdbApi.class);
//     }
// }
// 
// Path: app/src/test/java/com/daksh/tmdbsample/di/module/TestAppModule.java
// @Module
// public class TestAppModule {
// 
//     private final TestTmdbApplication application;
// 
//     public TestAppModule(TestTmdbApplication application) {
//         this.application = application;
//     }
// 
//     @Provides
//     @Singleton
//     Application provideApplication() {
//         return application;
//     }
// 
//     @Provides
//     @Singleton
//     Context provideContext() {
//         return application.getApplicationContext();
//     }
// }


// Path: app/src/test/java/com/daksh/tmdbsample/di/TestInjector.java
import com.daksh.tmdbsample.BuildConfig;
import com.daksh.tmdbsample.app.TestTmdbApplication;
import com.daksh.tmdbsample.di.component.DaggerTestAppComponent;
import com.daksh.tmdbsample.di.component.TestAppComponent;
import com.daksh.tmdbsample.di.module.NetworkModule;
import com.daksh.tmdbsample.di.module.TestAppModule;

package com.daksh.tmdbsample.di;


/**
 * Created by daksh on 03-Sep-16.
 */
public enum TestInjector {

    INSTANCE;

    private TestAppComponent testAppComponent;

    public TestAppComponent initializeAppComponent(TestTmdbApplication application) {
        testAppComponent = DaggerTestAppComponent.builder()
                .testAppModule(new TestAppModule(application))
                .networkModule(new NetworkModule(BuildConfig.BASE_URL, BuildConfig.API_KEY))
                .build();

        return testAppComponent;