### Question:
AppNotification implements Parcelable { public JSONObject toJson() { try { JSONObject notification = new JSONObject(); notification.put("appEvent", appEvent); notification.put("payload", payload); return notification; } catch (JSONException e) { Log.e(TAG, "Unexpected JSON error", e); return null; } } AppNotification(String appEvent, String payload);  AppNotification(JSONObject json);  AppNotification(Intent intent); @Override String toString(); JSONObject toJson(); @Override int describeContents(); @Override void writeToParcel(Parcel parcel, int i); @Override boolean equals(Object o); @Override int hashCode(); static final int MAX_PAYLOAD_LENGTH; final String appEvent; final String payload; static final Parcelable.Creator<AppNotification> CREATOR; }### Answer:
@Test public void testJSON() throws Exception { String appEvent = "sale"; String payload = "Sunday"; AppNotification an = new AppNotification(appEvent, payload); JSONObject json = an.toJson(); assertEquals(appEvent, json.getString("appEvent")); assertEquals(payload, json.getString("payload")); an = new AppNotification(json); assertEquals(appEvent, an.appEvent); assertEquals(payload, an.payload); }