+ static void verifyPostReplies(SimpleFieldSet postFieldSet, String prefix, List<PostReply> postReplies) throws FSParseException {
+ assertThat(postFieldSet.getInt(prefix + "Count"), CoreMatchers.is(from(postReplies).filter(FUTURE_REPLY_FILTER).size()));
+ int postReplyIndex = 0;
+ for (PostReply postReply : from(postReplies).filter(FUTURE_REPLY_FILTER)) {
+ verifyPostReply(postFieldSet, prefix + postReplyIndex + ".", postReply);
+ postReplyIndex++;
+ }
+ }
+
+ static void verifyPostsWithReplies(SimpleFieldSet postFieldSet, String prefix, List<Post> posts) throws FSParseException {
+ assertThat(postFieldSet.getInt(prefix + "Count"), CoreMatchers.is(posts.size()));
+ int postIndex = 0;
+ for (Post post : posts) {
+ verifyPost(postFieldSet, prefix + postIndex + ".", post);
+ verifyPostReplies(postFieldSet, prefix + postIndex + ".Replies.", post.getReplies());
+ postIndex++;
+ }
+ }
+
+ static void verifyPostWithReplies(SimpleFieldSet postFieldSet, String prefix, Post post) throws FSParseException {
+ verifyPost(postFieldSet, prefix, post);
+ verifyPostReplies(postFieldSet, prefix + "Replies.", post.getReplies());
+ }
+
+ static void verifyFollowedSone(SimpleFieldSet simpleFieldSet, String prefix, Sone sone) throws FSParseException {
+ verifyNotFollowedSone(simpleFieldSet, prefix, sone);
+ assertThat(simpleFieldSet.getBoolean(prefix + "Followed"), is(true));
+ }
+
+ static void verifyNotFollowedSone(SimpleFieldSet simpleFieldSet, String prefix, Sone sone) throws FSParseException {
+ assertThat(simpleFieldSet.get(prefix + "Name"), is(sone.getName()));
+ assertThat(simpleFieldSet.get(prefix + "NiceName"), is(getNiceName(sone)));
+ assertThat(simpleFieldSet.getLong(prefix + "LastUpdated"), is(sone.getTime()));
+ assertThat(simpleFieldSet.getInt(prefix + "Field.Count"), is(sone.getProfile().getFields().size()));
+ int fieldIndex = 0;
+ for (Field field : sone.getProfile().getFields()) {
+ assertThat(simpleFieldSet.get(prefix + "Field." + fieldIndex + ".Name"), is(field.getName()));
+ assertThat(simpleFieldSet.get(prefix + "Field." + fieldIndex + ".Value"), is(field.getValue()));
+ fieldIndex++;
+ }
+ }
+
+ static void verifySones(SimpleFieldSet simpleFieldSet, String prefix, List<Sone> sones) throws FSParseException {
+ assertThat(simpleFieldSet.getInt(prefix + "Count"), is(sones.size()));
+ int soneIndex = 0;
+ for (Sone sone : sones) {
+ assertThat(simpleFieldSet.get(prefix + soneIndex + ".ID"), is(sone.getId()));
+ assertThat(simpleFieldSet.get(prefix + soneIndex + ".Name"), is(sone.getName()));
+ assertThat(simpleFieldSet.get(prefix + soneIndex + ".NiceName"), is(getNiceName(sone)));
+ assertThat(simpleFieldSet.getLong(prefix + soneIndex + ".Time"), is(sone.getTime()));
+ soneIndex++;
+ }
+ }
+