【发布时间】:2020-06-17 12:38:16
【问题描述】:
在我的 KoinTest 中扩展
@Before
fun setUp() {
startKoin { modules(KoinStarter.getModules()) }
}
@Test
fun `should inject my components`() {
val settingsStore: SettingsStore = get()
assertNotNull(settingsStore)
}
我收到错误找不到类的定义:'android.content.Context'。检查你的定义!
但我的模块位于 KoinStarter.getModules()
val localDataModule = module {
factory<Resources> { get<Context>().resources }
single<SettingsStore> { SettingsStore(get<Context>()) }
}
【问题讨论】: