@Test(expected = JsonParseException.class) public void testNoDistrictName() { mData.remove("district_name"); mNotification = new DistrictPointsUpdatedNotification(mData.toString()); mNotification.parseMessageData(); }
@Override public void parseMessageData() throws JsonParseException { JsonObject jsonData = JSONHelper.getasJsonObject(messageData); if (!jsonData.has("district_name")) { throw new JsonParseException("district_name required"); } districtName = jsonData.get("district_name").getAsString(); if (!jsonData.has("district_key")) { throw new JsonParseException("district_key is required"); } districtKey = jsonData.get("district_key").getAsString(); }
DistrictPointsUpdatedNotification extends BaseNotification<GenericNotificationViewModel> { @Override public void parseMessageData() throws JsonParseException { JsonObject jsonData = JSONHelper.getasJsonObject(messageData); if (!jsonData.has("district_name")) { throw new JsonParseException("district_name required"); } districtName = jsonData.get("district_name").getAsString(); if (!jsonData.has("district_key")) { throw new JsonParseException("district_key is required"); } districtKey = jsonData.get("district_key").getAsString(); } }
DistrictPointsUpdatedNotification extends BaseNotification<GenericNotificationViewModel> { @Override public void parseMessageData() throws JsonParseException { JsonObject jsonData = JSONHelper.getasJsonObject(messageData); if (!jsonData.has("district_name")) { throw new JsonParseException("district_name required"); } districtName = jsonData.get("district_name").getAsString(); if (!jsonData.has("district_key")) { throw new JsonParseException("district_key is required"); } districtKey = jsonData.get("district_key").getAsString(); } DistrictPointsUpdatedNotification(String messageData); }
DistrictPointsUpdatedNotification extends BaseNotification<GenericNotificationViewModel> { @Override public void parseMessageData() throws JsonParseException { JsonObject jsonData = JSONHelper.getasJsonObject(messageData); if (!jsonData.has("district_name")) { throw new JsonParseException("district_name required"); } districtName = jsonData.get("district_name").getAsString(); if (!jsonData.has("district_key")) { throw new JsonParseException("district_key is required"); } districtKey = jsonData.get("district_key").getAsString(); } DistrictPointsUpdatedNotification(String messageData); @Override void parseMessageData(); String getDistrictName(); String getDistrictKey(); @Override Notification buildNotification(Context context, FollowsChecker followsChecker); @Override Intent getIntent(Context c); @Override void updateDataLocally(); @Override int getNotificationId(); @Nullable @Override GenericNotificationViewModel renderToViewModel(Context context, @Nullable Void aVoid); }
DistrictPointsUpdatedNotification extends BaseNotification<GenericNotificationViewModel> { @Override public void parseMessageData() throws JsonParseException { JsonObject jsonData = JSONHelper.getasJsonObject(messageData); if (!jsonData.has("district_name")) { throw new JsonParseException("district_name required"); } districtName = jsonData.get("district_name").getAsString(); if (!jsonData.has("district_key")) { throw new JsonParseException("district_key is required"); } districtKey = jsonData.get("district_key").getAsString(); } DistrictPointsUpdatedNotification(String messageData); @Override void parseMessageData(); String getDistrictName(); String getDistrictKey(); @Override Notification buildNotification(Context context, FollowsChecker followsChecker); @Override Intent getIntent(Context c); @Override void updateDataLocally(); @Override int getNotificationId(); @Nullable @Override GenericNotificationViewModel renderToViewModel(Context context, @Nullable Void aVoid);  }