ActivityTestRule<SplashActivity> = object : ActivityTestRule<SplashActivity>(SplashActivity::class.java) {
override fun beforeActivityLaunched() {
super.beforeActivityLaunched()
val app = InstrumentationRegistry.getTargetContext().applicationContext as App
val appComponent = DaggerSplashActivityTest_TestApplicationComponent.builder()
.applicationModule(ApplicationModule(app))
.infraLayerModule(InfraLayerModule())
.build()
app.component = appComponent
}
} @Singleton
@Component(modules = arrayOf(ApplicationModule::class, InfraLayerModule::class))
interface TestApplicationComponent : ApplicationComponent {
override fun activityComponent(): TestActivityComponent
}
@Subcomponent(modules = arrayOf(ActivityModule::class))
interface TestActivityComponent : ActivityComponent {
override fun fragmentComponent(): TestFragmentComponent
}
@Subcomponent(modules = arrayOf(TestInitializeFragmentModule::class))
interface TestFragmentComponent : FragmentComponent {
override fun inject(fragment: InitializeFragment)
}