### Question:
UrlDevice { public JSONObject jsonSerialize() { JSONObject jsonObject = new JSONObject(); jsonObject.put(ID_KEY, mId); jsonObject.put(URL_KEY, mUrl); if (mExtraData.length() > 0) { jsonObject.put(EXTRA_KEY, mExtraData); } return jsonObject; } private  UrlDevice(String id, String url, JSONObject extraData);  UrlDevice(String id, String url); String getId(); String getUrl(); boolean getExtraBoolean(String key); boolean optExtraBoolean(String key); boolean optExtraBoolean(String key, boolean defaultValue); int getExtraInt(String key); int optExtraInt(String key); int optExtraInt(String key, int defaultValue); long getExtraLong(String key); long optExtraLong(String key); long optExtraLong(String key, long defaultValue); double getExtraDouble(String key); double optExtraDouble(String key); double optExtraDouble(String key, double defaultValue); String getExtraString(String key); String optExtraString(String key); String optExtraString(String key, String defaultValue); JSONArray getExtraJSONArray(String key); JSONArray optExtraJSONArray(String key); JSONObject getExtraJSONObject(String key); JSONObject optExtraJSONObject(String key); JSONObject jsonSerialize(); static UrlDevice jsonDeserialize(JSONObject jsonObject); int hashCode(); boolean equals(Object other); int compareTo(UrlDevice other);  }### Answer:
@Test public void jsonSerializeWorks() { JSONAssert.assertEquals(mUrlDevice1.jsonSerialize(), jsonObject1, true); }