- assertThat(postFieldSet.getInt("Post.Replies.Count"), is(1));
- assertThat(postFieldSet.get("Post.Replies.0.ID"), is(postReply.getId()));
- assertThat(postFieldSet.get("Post.Replies.0.Sone"), is(postReply.getSone().getId()));
- assertThat(postFieldSet.getLong("Post.Replies.0.Time"), is(postReply.getTime()));
- assertThat(postFieldSet.get("Post.Replies.0.Text"), is(postReply.getText()));
+ verifyPostReplies(postFieldSet, "Post.", asList(postReply));
+ }
+
+ private void verifyPostReplies(SimpleFieldSet postFieldSet, String prefix, Collection<PostReply> postReplies) throws FSParseException {
+ assertThat(postFieldSet.getInt(prefix + "Replies.Count"), is(postReplies.size()));
+ int postReplyIndex = 0;
+ for (PostReply postReply : postReplies) {
+ assertThat(postFieldSet.get(prefix + "Replies." + postReplyIndex + ".ID"), is(postReply.getId()));
+ assertThat(postFieldSet.get(prefix + "Replies." + postReplyIndex + ".Sone"), is(postReply.getSone().getId()));
+ assertThat(postFieldSet.getLong(prefix + "Replies." + postReplyIndex + ".Time"), is(postReply.getTime()));
+ assertThat(postFieldSet.get(prefix + "Replies." + postReplyIndex + ".Text"), is(postReply.getText()));
+ postReplyIndex++;
+ }