PushMessage implements Parcelable, JsonSerializable { @Deprecated @Nullable public Uri getSound(@NonNull Context context) { if (sound == null && data.get(EXTRA_SOUND) != null) { String notificationSoundName = data.get(EXTRA_SOUND); int id = context.getResources().getIdentifier(notificationSoundName, "raw", context.getPackageName()); if (id != 0) { sound = Uri.parse("android.resource: } else if (!DEFAULT_SOUND_NAME.equals(notificationSoundName)) { Logger.warn("PushMessage - unable to find notification sound with name: %s", notificationSoundName); } } return sound; } PushMessage(@NonNull Bundle pushBundle);  PushMessage(@NonNull Map<String, String> data); @Nullable String getExtra(@NonNull String key); @NonNull String getExtra(@NonNull String key, @NonNull String defaultValue); boolean containsAirshipKeys(); @Nullable String getCanonicalPushId(); @Nullable String getRichPushMessageId(); @Nullable String getAlert(); @Nullable String getSendId(); @Nullable String getMetadata(); @NonNull Bundle getPushBundle(); boolean isAccengagePush(); boolean isAirshipPush(); @NonNull Map<String, ActionValue> getActions(); @Nullable String getInteractiveActionsPayload(); @Nullable String getInteractiveNotificationType(); @Nullable String getTitle(); @Nullable String getSummary(); @Nullable String getWearablePayload(); @Nullable String getStylePayload(); boolean isLocalOnly(); int getPriority(); int getVisibility(); @Nullable String getPublicNotificationPayload(); @Nullable String getCategory(); @Deprecated @Nullable Uri getSound(@NonNull Context context); int getIconColor(int defaultColor); @DrawableRes int getIcon(@NonNull Context context, int defaultIcon); @Nullable String getNotificationTag(); @Nullable String getNotificationChannel(); @Nullable String getNotificationChannel(@Nullable String defaultChannel); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Nullable static PushMessage fromIntent(@Nullable Intent intent); @NonNull @Override String toString(); @Override int describeContents(); @Override void writeToParcel(@NonNull Parcel dest, int flags); @NonNull @Override JsonValue toJsonValue(); @NonNull static PushMessage fromJsonValue(@NonNull JsonValue jsonValue); boolean containsKey(@NonNull String key); @NonNull
    static final String EXTRA_RICH_PUSH_ID; @NonNull
    static final String EXTRA_ALERT; @NonNull
    static final String EXTRA_SEND_ID; @NonNull
    static final String EXTRA_METADATA; @NonNull
    static final String EXTRA_ACTIONS; @NonNull
    static final String EXTRA_INTERACTIVE_ACTIONS; @NonNull
    static final String EXTRA_INTERACTIVE_TYPE; @NonNull
    static final String EXTRA_TITLE; @NonNull
    static final String EXTRA_SUMMARY; @NonNull
    static final String EXTRA_WEARABLE; @NonNull
    static final String EXTRA_STYLE; @NonNull
    static final String EXTRA_LOCAL_ONLY; @NonNull
    static final String EXTRA_ICON_COLOR; @NonNull
    static final String EXTRA_ICON; @NonNull
    static final String EXTRA_PRIORITY; @Deprecated
    @NonNull
    static final String EXTRA_SOUND; @NonNull
    static final String EXTRA_VISIBILITY; @NonNull
    static final String EXTRA_PUBLIC_NOTIFICATION; @NonNull
    static final String EXTRA_CATEGORY; @NonNull
    static final String EXTRA_PUSH_ID; @NonNull
    static final String EXTRA_EXPIRATION; @NonNull
    static final String EXTRA_IN_APP_MESSAGE; @NonNull
    static final String EXTRA_NOTIFICATION_TAG; @NonNull
    static final String EXTRA_NOTIFICATION_CHANNEL; @NonNull
    static final String EXTRA_DELIVERY_PRIORITY; @NonNull
    static final String PRIORITY_HIGH; @NonNull
    static final Parcelable.Creator<PushMessage> CREATOR; }
@Test public void testGetSound() { Context context = Mockito.spy(UAirship.getApplicationContext()); Resources resources = Mockito.mock(Resources.class); Mockito.when(resources.getIdentifier(Mockito.eq("test_sound"), Mockito.anyString(), Mockito.anyString())).thenReturn(5); Mockito.when(context.getResources()).thenReturn(resources); Bundle extras = new Bundle(); extras.putString(PushMessage.EXTRA_SOUND, "test_sound"); PushMessage pushMessage = new PushMessage(extras); Uri expected = Uri.parse("android.resource: Assert.assertEquals("The sound should match.", expected, pushMessage.getSound(context)); }
@Test public void testGetSoundNull() { Context context = UAirship.getApplicationContext(); Bundle extras = new Bundle(); extras.putString(PushMessage.EXTRA_SOUND, "test_sound"); PushMessage pushMessage = new PushMessage(extras); Assert.assertNull("The sound should be null.", pushMessage.getSound(context)); }