Code example for PackageInfo

0
    assertThat(info.packageName).isEqualTo(Robolectric.application.getPackageName());
  } 
 
  @Test 
  public void getApplicationInfo__OtherApplication() throws Exception { 
    PackageInfo packageInfo = new PackageInfo();
    packageInfo.packageName = TEST_PACKAGE_NAME;
    packageInfo.applicationInfo = new ApplicationInfo();
    packageInfo.applicationInfo.packageName = TEST_PACKAGE_NAME;
    packageInfo.applicationInfo.name = TEST_PACKAGE_LABEL;
    rpm.addPackage(packageInfo);
 
    ApplicationInfo info = rpm.getApplicationInfo(TEST_PACKAGE_NAME, 0);
    assertThat(info).isNotNull();
    assertThat(info.packageName).isEqualTo(TEST_PACKAGE_NAME);
    assertThat(rpm.getApplicationLabel(info).toString()).isEqualTo(TEST_PACKAGE_LABEL);
  } 
 
  @Test(expected = PackageManager.NameNotFoundException.class) 
  public void removePackage_shouldHideItFromGetApplicationInfo() throws Exception { 
    PackageInfo packageInfo = new PackageInfo();