esdudnik
10/29/2018, 3:32 PM@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
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)