package com.felipecosta.kotlinrxjavasample.di

import android.content.Context
import android.support.test.InstrumentationRegistry
import dagger.Module
import dagger.Provides
import javax.inject.Singleton

@Module
class TestApplicationModule {

    @Singleton
    @Provides
    fun providesApplicationContext(): Context = InstrumentationRegistry.getContext().applicationContext
}
package com.felipecosta.kotlinrxjavasample.di

import android.content.Context
import android.support.test.InstrumentationRegistry
import dagger.Module
import dagger.Provides
import javax.inject.Singleton

@Module
class TestApplicationModule {

    @Singleton
    @Provides
    fun providesApplicationContext(): Context = InstrumentationRegistry.getTargetContext()
}
Use the target context in the instrumentation test module
Use the target context in the instrumentation test module

fcostaa/kotlin-rxjava-android,fcostaa/kotlin-rxjava-android