import static java.lang.System.currentTimeMillis;
import static java.util.Arrays.asList;
import static java.util.concurrent.TimeUnit.DAYS;
-import static net.pterodactylus.sone.fcp.Verifiers.verifyPostsWithReplies;
+import static net.pterodactylus.sone.Verifiers.verifyAnswer;
+import static net.pterodactylus.sone.Verifiers.verifyPostsWithReplies;
import static net.pterodactylus.sone.freenet.fcp.Command.AccessType.DIRECT;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
import java.util.Collections;
.put("Sone", "LSone")
.get();
Response response = getPostFeedCommand.execute(getPostFeedFieldSet, null, DIRECT);
- assertThat(response, notNullValue());
- assertThat(response.getReplyParameters(), notNullValue());
- assertThat(response.getReplyParameters().get("Message"), is("PostFeed"));
+ verifyAnswer(response, "PostFeed");
verifyPostsWithReplies(response.getReplyParameters(), "Posts.", asList(localPost, friendPost, remotePost));
}
.put("StartPost", "1")
.get();
Response response = getPostFeedCommand.execute(getPostFeedFieldSet, null, DIRECT);
- assertThat(response, notNullValue());
- assertThat(response.getReplyParameters(), notNullValue());
- assertThat(response.getReplyParameters().get("Message"), is("PostFeed"));
+ verifyAnswer(response, "PostFeed");
verifyPostsWithReplies(response.getReplyParameters(), "Posts.", asList(friendPost, remotePost));
}
.put("MaxPosts", "2")
.get();
Response response = getPostFeedCommand.execute(getPostFeedFieldSet, null, DIRECT);
- assertThat(response, notNullValue());
- assertThat(response.getReplyParameters(), notNullValue());
- assertThat(response.getReplyParameters().get("Message"), is("PostFeed"));
+ verifyAnswer(response, "PostFeed");
verifyPostsWithReplies(response.getReplyParameters(), "Posts.", asList(localPost, friendPost));
}
.put("StartPost", "1")
.get();
Response response = getPostFeedCommand.execute(getPostFeedFieldSet, null, DIRECT);
- assertThat(response, notNullValue());
- assertThat(response.getReplyParameters(), notNullValue());
- assertThat(response.getReplyParameters().get("Message"), is("PostFeed"));
+ verifyAnswer(response, "PostFeed");
verifyPostsWithReplies(response.getReplyParameters(), "Posts.", asList(friendPost));
}
.put("StartPost", "10")
.get();
Response response = getPostFeedCommand.execute(getPostFeedFieldSet, null, DIRECT);
- assertThat(response, notNullValue());
- assertThat(response.getReplyParameters(), notNullValue());
- assertThat(response.getReplyParameters().get("Message"), is("PostFeed"));
+ verifyAnswer(response, "PostFeed");
verifyPostsWithReplies(response.getReplyParameters(), "Posts.", Collections.<Post>emptyList());
}