Code example for ArrayList

Methods: clear, get, size

0
 
    // Test match 
    List<IntentFilter> filters = new ArrayList<IntentFilter>();
    filters.add(filter);
 
    List<ComponentName> activities = new ArrayList<ComponentName>();
    rpm.getPreferredActivities(filters, activities, null);
 
    assertThat(activities.size()).isEqualTo(1);
    assertThat(activities.get(0).getPackageName()).isEqualTo(packageName);
 
    // Test not match 
    IntentFilter filter1 = new IntentFilter(Intent.ACTION_VIEW);
    filters.add(filter1);
    filters.clear();
    activities.clear();
    filters.add(filter1);
 
    rpm.getPreferredActivities(filters, activities, null);
 
    assertThat(activities.size()).isEqualTo(0);
  } 
 
  @Test 
  public void canResolveDrawableGivenPackageAndResourceId() throws Exception { 
    Drawable drawable = ShadowDrawable.createFromStream(new ByteArrayInputStream(new byte[0]), "my_source");