Archie
09/23/2022, 7:44 AMfun someFunctionInsideActivity() {
val intent = try {
packageManager.getLaunchIntentForPackage("some.app.id")
} catch (e: Exception) {
Intent(
Intent.ACTION_VIEW,
Uri.parse(webSiteUrl)
)
}
startActivity(intent)
}
I want to write Espresso
test for both scenario. I was wondering if its possible to Mock the return of packageManager.getLaunchIntentForPackage(...)
so that I could test both scenario in test.
Any ideas? Any other way of testing this would be appreciated.
Thanks in advance.Juliane Lehmann
09/23/2022, 8:38 AMJuliane Lehmann
09/23/2022, 8:39 AMArchie
09/23/2022, 9:12 AMephemient
09/23/2022, 11:25 AMArchie
09/23/2022, 1:06 PM