How can I shadow the PackageManager with Robolectric

后端 未结 6 826
有刺的猬
有刺的猬 2020-12-15 22:16

My Android application has a simple method to fire off an intent to display a URL.

protected void launchBrowser(int id)
{
    Uri uri = Uri.parse( getStrin         


        
6条回答
  •  春和景丽
    2020-12-15 23:04

    For Robolectric 3.1 you can

    RobolectricPackageManager packageManager = RuntimeEnvironment.getRobolectricPackageManager();
    // add necessary logic here
    

提交回复
热议问题