Hello guys. I am using Koin in our project and cur...
# koin
e
Hello guys. I am using Koin in our project and currently now I am writing Espresso test. I faced the strange problem when test is running on API 28 emulator, but doesn’t work in API 22 version. Here is the test
Copy code
@RunWith(AndroidJUnit4::class)
class AboutControllerEspressoTest : AutoCloseKoinTest() {

    private val OSM_CACHE_PATH = "osm"

    @get:Rule
    val activityTestRule = ActivityTestRule<MainActivity>(MainActivity::class.java, true, false)

    private val controller = AboutController()

    @Before
    fun setup() {
        PreferenceManager. getDefaultSharedPreferences(getInstrumentation().targetContext).edit().putString(OSM_CACHE_PATH, "testPath").apply()
        activityTestRule.launchActivity(Intent())
        activityTestRule.runOnUiThread {
 activityTestRule.activity.router.setRoot(RouterTransaction.with(controller))
        }
    }

    @Test
    fun testVersionText() {
           val expectedVersion = String.format(<http://Locale.US|Locale.US>, activityTestRule.activity.getText(R.string.about_version).toString(), BuildConfig.VERSION_NAME)
           onView(withId(R.id.about_version)). check(matches(withText(expectedVersion)))
    }
}
on 28 version everything works, on 22 I receive
Copy code
org.koin.error.BeanOverrideException: Try to override definition with Single
It’s strange because I receive that error before, until I extend my test class for AutoCloseKoinTest. Does anybody know what can a problem? i will appreciate any help)