PushMessage implements Parcelable, JsonSerializable { @NonNull public Map<String, ActionValue> getActions() { String actionsPayload = data.get(EXTRA_ACTIONS); Map<String, ActionValue> actions = new HashMap<>(); try { JsonMap actionsJson = JsonValue.parseString(actionsPayload).getMap(); if (actionsJson != null) { for (Map.Entry<String, JsonValue> entry : actionsJson) { actions.put(entry.getKey(), new ActionValue(entry.getValue())); } } } catch (JsonException e) { Logger.error("Unable to parse action payload: %s", actionsPayload); return actions; } if (!UAStringUtil.isEmpty(getRichPushMessageId())) { actions.put(MESSAGE_CENTER_ACTION, ActionValue.wrap(getRichPushMessageId())); } return actions; } 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 testGetActions() throws JsonException { Map<String, ActionValue> actions = new HashMap<>(); actions.put("action_name", ActionValue.wrap("action_value")); actions.put("oh", ActionValue.wrap("hi")); Bundle bundle = new Bundle(); bundle.putString(PushMessage.EXTRA_ACTIONS, JsonValue.wrap(actions).toString()); PushMessage message = new PushMessage(bundle); assertEquals(actions, message.getActions()); }
@Test public void testGetActionsInvalidPayload() { Bundle bundle = new Bundle(); bundle.putString(PushMessage.EXTRA_ACTIONS, "}}what{{"); PushMessage message = new PushMessage(bundle); assertTrue(message.getActions().isEmpty()); }