### Question:
UrlDevice { public int compareTo(UrlDevice other) { if (this == other) { return 0; } int compareValue = mId.compareTo(other.getId()); if (compareValue != 0) { return compareValue; } return mUrl.compareTo(other.getUrl()); } 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 compareDeviceToItselfReturnsZero() { assertEquals(mUrlDevice1.compareTo(mUrlDevice1), 0); }
@Test public void compareDeviceToUnalikeDeviceReturnsNonZero() { UrlDevice urlDevice2 = new UrlDevice(ID2, URL1); UrlDevice urlDevice3 = new UrlDevice(ID1, URL2); assertTrue(mUrlDevice1.compareTo(urlDevice2) < 0); assertTrue(urlDevice2.compareTo(mUrlDevice1) > 0); assertTrue(mUrlDevice1.compareTo(urlDevice3) < 0); assertTrue(urlDevice3.compareTo(mUrlDevice1) > 0); }