### Question:
CommentsConverter implements Converter { private String getPostContents(String title, String description) { if (StringUtils.isEmpty(title)) { return description; } if (StringUtils.isEmpty(description)) { return title; } return title + "\n\n" + description; } CommentsConverter(Gson gson, GsonConverter gsonConverter, Resources resources,
                             UserStorage userStorage); @Override Object fromBody(TypedInput body, Type type); @Override TypedOutput toBody(Object object);  }### Answer:
@Test public void parsesCommentsSuccessfully() throws Exception { List<Comment> comments = convertComments("comment-default.json"); assertThat(comments.size(), equalTo(2)); assertThat(comments.get(0).getPostContents(), equalTo("first reply lol")); assertThat(comments.get(0).getReplyLevel(), equalTo(1)); assertThat(comments.get(0).getScore(), equalTo(1)); assertThat(comments.get(0).getReplies().size(), equalTo(1)); assertThat(comments.get(0).getReplies().get(0).getPostContents(), equalTo("reply to first reply")); assertThat(comments.get(0).getReplies().get(0).getReplyLevel(), equalTo(2)); assertThat(comments.get(1).getPostContents(), equalTo("second reply")); assertThat(comments.get(1).getReplyLevel(), equalTo(1)); }
@Test public void parsesSingleCommentSuccessfully() throws Exception { Comment comment = convertComments("comment-default.json").get(0); assertThat(comment.getAuthor(), equalTo("awesomesaucetester")); assertThat(comment.getPostContents(), equalTo("first reply lol")); assertThat(comment.isScoreHidden(), equalTo(true)); assertThat(comment.getScore(), equalTo(1)); assertThat(comment.getGilded(), equalTo(0)); assertThat(comment.getReplyLevel(), equalTo(1)); assertThat(comment.getReplies().size(), equalTo(1)); }