# koin

Nikola Milovic

08/21/2020, 4:15 PM
My previous post was deleted it seems. Basically I still haven't found a better way of loading/ unloading modules for Single activity, Multi-Module Feature approach. Loading and deloading of modules in fragments attach and detach works well, until it comes to UI testing. Then it is impossible to swap out the modules to test modules. I was using this approach in my fragment
Copy code
private val moduleList = arrayListOf(dataModule, viewmodelModule)

    private val loadModules by lazy {

    private fun injectFeatures() = loadModules

//and then just call inject on attach and deload on detach
And in my tests
Copy code
    fun setUp() {
        loadKoinModules(listOf(testViewModelModule, testDataModule))
Any input would be really helpful!