test_class.file: sdk-libs/halo-notifications/src/test/java/com/mobgen/halo/android/notifications/decorator/NotificationSoundDecoratorTest.java
test_class.identifier: NotificationSoundDecoratorTest
test_class.superclass: extends BaseNotificationDecoratorTest<NotificationSoundDecorator>
test_case.body: @Test
      public void soundTest() {
          //Mock decorator context
          final boolean[] marker = new boolean[1];
          final String ringtone = "adara";
          Context context = mock(Context.class);
          Resources res = mock(Resources.class);
          NotificationSoundDecorator decorator = new NotificationSoundDecorator(context, null);
          when(context.getResources()).thenReturn(res);
          when(res.getIdentifier(ringtone, "raw", context.getPackageName())).thenReturn(1);
          when(res.getResourcePackageName(1)).thenReturn("com.mobgen.halo.android.sdk");
          when(res.getResourceTypeName(1)).thenReturn("raw");
          when(res.getResourceEntryName(1)).thenReturn(ringtone);
  
          Bundle bundle = BundleTestUtils.builder().putString("sound", ringtone).build();
          when(getBuilder().setSound(any(Uri.class))).then(new Answer<Object>() {
              @Override
              public Object answer(InvocationOnMock invocation) throws Throwable {
                  marker[0] = true;
                  Assert.assertEquals(Uri.parse("android.resource://com.mobgen.halo.android.sdk/raw/" + ringtone), invocation.getArguments()[0]);
                  return null;
              }
          });
          decorator.decorate(getBuilder(), bundle);
          Assert.assertTrue(marker[0]);
      }
test_case.class_method_signature: NotificationSoundDecoratorTest.soundTest()
test_case.full_signature: @Test public void soundTest()
test_case.identifier: soundTest
test_case.invocations: mock mock thenReturn when getResources thenReturn when getIdentifier getPackageName thenReturn when getResourcePackageName thenReturn when getResourceTypeName thenReturn when getResourceEntryName build putString builder then when setSound getBuilder any assertEquals parse getArguments decorate getBuilder assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void soundTest()
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/NotificationSoundDecorator.java
focal_class.identifier: NotificationSoundDecorator
focal_class.class_method_signature: NotificationSoundDecorator.NotificationSoundDecorator(Context context, HaloNotificationDecorator decorator)
focal_class.full_signature: public  NotificationSoundDecorator(Context context, HaloNotificationDecorator decorator)
focal_class.identifier: NotificationSoundDecorator
focal_class.modifiers: public
focal_class.parameters: (Context context, HaloNotificationDecorator decorator)
focal_class.signature:  NotificationSoundDecorator(Context context, HaloNotificationDecorator decorator)
focal_class.class_method_signature: NotificationSoundDecorator.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 sound = bundle.getString("sound");
          if (!TextUtils.isEmpty(sound)) {
              Uri soundUri = null;
              if ("default".equalsIgnoreCase(sound)) {
                  soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
              } else {
                  int soundId = mContext.getResources().getIdentifier(sound, "raw", mContext.getPackageName());
                  if (soundId != 0) {
                      soundUri = HaloUtils.getUriFromResource(mContext, soundId);
                  }
              }
              if (soundUri != null) {
                  builder.setSound(soundUri);
              }
          }
          return chain(builder, bundle);
      }
focal_method.class_method_signature: NotificationSoundDecorator.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 equalsIgnoreCase getDefaultUri getIdentifier getResources getPackageName getUriFromResource setSound 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)