test_class.declarator: mContext
test_class.modifier: private
test_class.original_string: private Context mContext;
test_class.type: Context
test_class.var_name: mContext
test_class.declarator: mResources
test_class.modifier: private
test_class.original_string: private Resources mResources;
test_class.type: Resources
test_class.var_name: mResources
test_class.file: sdk-libs/halo-notifications/src/test/java/com/mobgen/halo/android/notifications/decorator/NotificationIconDecoratorTest.java
test_class.identifier: NotificationIconDecoratorTest
test_class.superclass: extends BaseNotificationDecoratorTest<NotificationIconDecorator>
test_case.body: @Test
      public void emptyIconTest() {
          final boolean[] marker = new boolean[1];
          PackageManager manager = mock(PackageManager.class);
          when(mContext.getPackageManager()).thenReturn(manager);
          ApplicationInfo info = mock(ApplicationInfo.class);
          info.icon = 2;
          try {
              when(manager.getApplicationInfo(null, PackageManager.GET_META_DATA)).thenReturn(info);
          } catch (PackageManager.NameNotFoundException e) {
              Assert.fail();
          }
          Bundle bundle = BundleTestUtils.builder().build();
          when(getBuilder().setSmallIcon(any(Integer.class))).then(new Answer<Object>() {
              @Override
              public Object answer(InvocationOnMock invocation) throws Throwable {
                  marker[0] = true;
                  return null;
              }
          });
          getDecorator().decorate(getBuilder(), bundle);
          Assert.assertTrue(marker[0]);
      }
test_case.class_method_signature: NotificationIconDecoratorTest.emptyIconTest()
test_case.full_signature: @Test public void emptyIconTest()
test_case.identifier: emptyIconTest
test_case.invocations: mock thenReturn when getPackageManager mock thenReturn when getApplicationInfo fail build builder then when setSmallIcon getBuilder any decorate getDecorator getBuilder assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void emptyIconTest()
focal_class.declarator: mContext
focal_class.modifier: private
focal_class.original_string: private Context mContext;
focal_class.type: Context
focal_class.var_name: mContext
focal_class.file: sdk-libs/halo-notifications/src/main/java/com/mobgen/halo/android/notifications/decorator/NotificationIconDecorator.java
focal_class.identifier: NotificationIconDecorator
focal_class.class_method_signature: NotificationIconDecorator.NotificationIconDecorator(Context context, HaloNotificationDecorator decorator)
focal_class.full_signature: public  NotificationIconDecorator(Context context, HaloNotificationDecorator decorator)
focal_class.identifier: NotificationIconDecorator
focal_class.modifiers: public
focal_class.parameters: (Context context, HaloNotificationDecorator decorator)
focal_class.signature:  NotificationIconDecorator(Context context, HaloNotificationDecorator decorator)
focal_class.class_method_signature: NotificationIconDecorator.decorate(@NonNull NotificationCompat.Builder builder, @NonNull Bundle bundle)
focal_class.full_signature: @Override public NotificationCompat.Builder decorate(@NonNull NotificationCompat.Builder builder, @NonNull Bundle bundle)
focal_class.identifier: decorate
focal_class.modifiers: @Override public
focal_class.parameters: (@NonNull NotificationCompat.Builder builder, @NonNull Bundle bundle)
focal_class.return: NotificationCompat.Builder
focal_class.signature: NotificationCompat.Builder decorate(@NonNull NotificationCompat.Builder builder, @NonNull Bundle bundle)
focal_class.superclass: extends HaloNotificationDecorator
focal_method.body: @Override
      public NotificationCompat.Builder decorate(@NonNull NotificationCompat.Builder builder, @NonNull Bundle bundle) {
          String iconName = bundle.getString("icon");
          if (TextUtils.isEmpty(iconName)) {
              iconName = "";
          }
          Resources resources = mContext.getResources();
          int drawableId = resources.getIdentifier(iconName, "drawable", mContext.getPackageName());
          if (drawableId == 0) {
              drawableId = resources.getIdentifier(iconName, "mipmap", mContext.getPackageName());
          }
          if (drawableId == 0) { // Get the default application icon
              try {
                  drawableId = mContext.getPackageManager().getApplicationInfo(mContext.getPackageName(), PackageManager.GET_META_DATA).icon;
              } catch (PackageManager.NameNotFoundException e) {
                  Halog.e(getClass(), "Could not get the application icon.");
              }
          }
          builder.setSmallIcon(drawableId);
          return chain(builder, bundle);
      }
focal_method.class_method_signature: NotificationIconDecorator.decorate(@NonNull NotificationCompat.Builder builder, @NonNull Bundle bundle)
focal_method.full_signature: @Override public NotificationCompat.Builder decorate(@NonNull NotificationCompat.Builder builder, @NonNull Bundle bundle)
focal_method.identifier: decorate
focal_method.invocations: getString isEmpty getResources getIdentifier getPackageName getIdentifier getPackageName getApplicationInfo getPackageManager getPackageName e getClass setSmallIcon chain
focal_method.modifiers: @Override public
focal_method.parameters: (@NonNull NotificationCompat.Builder builder, @NonNull Bundle bundle)
focal_method.return: NotificationCompat.Builder
focal_method.signature: NotificationCompat.Builder decorate(@NonNull NotificationCompat.Builder builder, @NonNull Bundle bundle)