Code example for ResolveInfo

0
    } 
 
    @Test 
    public void resolveActivity__Match() throws Exception { 
        Intent i = new Intent(Intent.ACTION_MAIN, null).addCategory(Intent.CATEGORY_LAUNCHER);
        ResolveInfo info = new ResolveInfo();
        info.nonLocalizedLabel = TEST_PACKAGE_LABEL;
        rpm.addResolveInfoForIntent(i, info);
 
        assertThat(rpm.resolveActivity(i, 0)).isSameAs(info);
    } 
 
    @Test 
    public void resolveActivity__NoMatch() throws Exception { 
        Intent i = new Intent();
        i.setComponent(new ComponentName("foo.bar", "No Activity"));
        assertThat(rpm.resolveActivity(i, 0)).isNull();
    } 
 
    @Test