@Test(expected = JsonParseException.class) public void testNoEventKey() { mData.remove("event_key"); mNotification = new ScheduleUpdatedNotification(mData.toString()); mNotification.parseMessageData(); }
@Override public void parseMessageData() throws JsonParseException { JsonObject jsonData = JSONHelper.getasJsonObject(messageData); if (!jsonData.has("event_name")) { throw new JsonParseException("Notification data does not contain 'event_name"); } eventName = jsonData.get("event_name").getAsString(); if (!jsonData.has("event_key")) { throw new JsonParseException("Notification data does not contain 'event_key"); } eventKey = jsonData.get("event_key").getAsString(); matchTime = jsonData.get("first_match_time"); }
ScheduleUpdatedNotification extends BaseNotification<ScheduleUpdatedNotificationViewModel> { @Override public void parseMessageData() throws JsonParseException { JsonObject jsonData = JSONHelper.getasJsonObject(messageData); if (!jsonData.has("event_name")) { throw new JsonParseException("Notification data does not contain 'event_name"); } eventName = jsonData.get("event_name").getAsString(); if (!jsonData.has("event_key")) { throw new JsonParseException("Notification data does not contain 'event_key"); } eventKey = jsonData.get("event_key").getAsString(); matchTime = jsonData.get("first_match_time"); } }
ScheduleUpdatedNotification extends BaseNotification<ScheduleUpdatedNotificationViewModel> { @Override public void parseMessageData() throws JsonParseException { JsonObject jsonData = JSONHelper.getasJsonObject(messageData); if (!jsonData.has("event_name")) { throw new JsonParseException("Notification data does not contain 'event_name"); } eventName = jsonData.get("event_name").getAsString(); if (!jsonData.has("event_key")) { throw new JsonParseException("Notification data does not contain 'event_key"); } eventKey = jsonData.get("event_key").getAsString(); matchTime = jsonData.get("first_match_time"); } ScheduleUpdatedNotification(String messageData); }
ScheduleUpdatedNotification extends BaseNotification<ScheduleUpdatedNotificationViewModel> { @Override public void parseMessageData() throws JsonParseException { JsonObject jsonData = JSONHelper.getasJsonObject(messageData); if (!jsonData.has("event_name")) { throw new JsonParseException("Notification data does not contain 'event_name"); } eventName = jsonData.get("event_name").getAsString(); if (!jsonData.has("event_key")) { throw new JsonParseException("Notification data does not contain 'event_key"); } eventKey = jsonData.get("event_key").getAsString(); matchTime = jsonData.get("first_match_time"); } ScheduleUpdatedNotification(String messageData); String getEventName(); String getEventKey(); JsonElement getMatchTime(); @Override void parseMessageData(); @Override Notification buildNotification(Context context, FollowsChecker followsChecker); @Override void updateDataLocally(); @Override Intent getIntent(Context c); @Override int getNotificationId(); @Override View getView(Context c, LayoutInflater inflater, View convertView); @Nullable @Override ScheduleUpdatedNotificationViewModel renderToViewModel(Context context, @Nullable Void aVoid); }
ScheduleUpdatedNotification extends BaseNotification<ScheduleUpdatedNotificationViewModel> { @Override public void parseMessageData() throws JsonParseException { JsonObject jsonData = JSONHelper.getasJsonObject(messageData); if (!jsonData.has("event_name")) { throw new JsonParseException("Notification data does not contain 'event_name"); } eventName = jsonData.get("event_name").getAsString(); if (!jsonData.has("event_key")) { throw new JsonParseException("Notification data does not contain 'event_key"); } eventKey = jsonData.get("event_key").getAsString(); matchTime = jsonData.get("first_match_time"); } ScheduleUpdatedNotification(String messageData); String getEventName(); String getEventKey(); JsonElement getMatchTime(); @Override void parseMessageData(); @Override Notification buildNotification(Context context, FollowsChecker followsChecker); @Override void updateDataLocally(); @Override Intent getIntent(Context c); @Override int getNotificationId(); @Override View getView(Context c, LayoutInflater inflater, View convertView); @Nullable @Override ScheduleUpdatedNotificationViewModel renderToViewModel(Context context, @Nullable Void aVoid);  }