I've been using a BaseTest class for Espresso something like this :
abstract class BaseTest<T : Activity> {
val context: Context = InstrumentationRegistry.getInstrumentation().targetContext
abstract fun getTestActivity(): IntentsTestRule<T>
abstract fun startIntentActivity()
@Rule
@JvmField
var activityTestRule = this.getTestActivity()
fun launchActivity(intent: Intent?) {
getTestActivity().launchActivity(intent)
}
@Before
fun setUp() {
startIntentActivity()
}
@After
fun tearDown() {
activityTestRule.finishActivity()
}
}
But now I'm seeing that abstract fun getTestActivity(): IntentsTestRule<T> is deprecated and we should use ActivityScenario and ActivityScenarioRule how should I modify that class to use the new clases?