Submission implements Serializable { public FlattrObject toFlattrObject() throws FlattrException { FlattrObject result = new FlattrObject(); result.put("url", url); if (hidden != null) { result.put("hidden", hidden); } if (title != null) { result.put("title", title); } if (description != null) { result.put("description", description); } if (category != null) { result.put("category", category); } if (language != null) { result.put("language", language); } if (tags != null && !tags.isEmpty()) { result.put("tags", getTagsAsString()); } return result; }  String getUrl(); void setUrl(String url); String getTitle(); void setTitle(String title); String getDescription(); void setDescription(String description); List<String> getTags(); void setTags(List<String> tags); void addTag(String tag); CategoryId getCategory(); void setCategory(CategoryId category); LanguageId getLanguage(); void setLanguage(LanguageId language); Boolean isHidden(); void setHidden(Boolean hidden); String getTagsAsString(); FlattrObject toFlattrObject();  }
@Test public void testModel() throws FlattrException, IOException { Submission sub = new Submission(); setupSubmission(sub); FlattrObject data = sub.toFlattrObject(); assertThat(data, jsonValue("url", is("http: assertThat(data, jsonValue("title", is("flattr4j"))); assertThat(data, jsonValue("description", is("A Flattr library for Java"))); assertThat(data, jsonValue("category", is("text"))); assertThat(data, jsonValue("language", is("en_UK"))); assertThat(data, jsonValue("hidden", is(false))); assertThat(data, jsonValue("tags", is("foo,bar"))); }