@Test public void toJsonInputEmptyExpectedEmptySettingsAndSignatures() throws Exception { InputStream stream = SeriesEndpointTest.class.getResourceAsStream("/user_settings_test_empty.json"); InputStreamReader reader = new InputStreamReader(stream); JSONObject expected = (JSONObject) new JSONParser().parse(reader); UserSettings userSetting = new UserSettings(); assertThat(expected.toJSONString(), SameJSONAs.sameJSONAs(userSetting.toJson().toJson())); }
public Obj toJson() { List<Val> settingsArr = new ArrayList<Val>(); for (UserSetting userSetting : getUserSettingsCollection()) { settingsArr.add(userSetting.toJson()); } return Jsons.obj(Jsons.p("offset", offset), Jsons.p("limit", limit), Jsons.p("total", total),Jsons.p("results", Jsons.arr(settingsArr))); }
UserSettings { public Obj toJson() { List<Val> settingsArr = new ArrayList<Val>(); for (UserSetting userSetting : getUserSettingsCollection()) { settingsArr.add(userSetting.toJson()); } return Jsons.obj(Jsons.p("offset", offset), Jsons.p("limit", limit), Jsons.p("total", total),Jsons.p("results", Jsons.arr(settingsArr))); } }
UserSettings { public Obj toJson() { List<Val> settingsArr = new ArrayList<Val>(); for (UserSetting userSetting : getUserSettingsCollection()) { settingsArr.add(userSetting.toJson()); } return Jsons.obj(Jsons.p("offset", offset), Jsons.p("limit", limit), Jsons.p("total", total),Jsons.p("results", Jsons.arr(settingsArr))); } UserSettings();  UserSettings(Map<String, Collection<UserSetting>> userSettings); }
UserSettings { public Obj toJson() { List<Val> settingsArr = new ArrayList<Val>(); for (UserSetting userSetting : getUserSettingsCollection()) { settingsArr.add(userSetting.toJson()); } return Jsons.obj(Jsons.p("offset", offset), Jsons.p("limit", limit), Jsons.p("total", total),Jsons.p("results", Jsons.arr(settingsArr))); } UserSettings();  UserSettings(Map<String, Collection<UserSetting>> userSettings); Map<String, Collection<UserSetting>> getUserSettingsMap(); Collection<UserSetting> getUserSettingsCollection(); void setUserSettings(Map<String, Collection<UserSetting>> userSettings); void addUserSetting(UserSetting userSetting); int getTotal(); void setTotal(int total); int getLimit(); void setLimit(int limit); int getOffset(); void setOffset(int offset); Obj toJson(); }
UserSettings { public Obj toJson() { List<Val> settingsArr = new ArrayList<Val>(); for (UserSetting userSetting : getUserSettingsCollection()) { settingsArr.add(userSetting.toJson()); } return Jsons.obj(Jsons.p("offset", offset), Jsons.p("limit", limit), Jsons.p("total", total),Jsons.p("results", Jsons.arr(settingsArr))); } UserSettings();  UserSettings(Map<String, Collection<UserSetting>> userSettings); Map<String, Collection<UserSetting>> getUserSettingsMap(); Collection<UserSetting> getUserSettingsCollection(); void setUserSettings(Map<String, Collection<UserSetting>> userSettings); void addUserSetting(UserSetting userSetting); int getTotal(); void setTotal(int total); int getLimit(); void setLimit(int limit); int getOffset(); void setOffset(int offset); Obj toJson();  }