Move name of message into method parameter.
[Sone.git] / src / test / java / net / pterodactylus / sone / fcp / GetPostCommandTest.java
index c6664b9..2c72cdf 100644 (file)
@@ -59,7 +59,7 @@ public class GetPostCommandTest {
                                .put("Post", "PostId")
                                .get();
                Response response = getPostCommand.execute(getPostFieldSet, null, DIRECT);
-               verifyAnswer(response);
+               verifyAnswer(response, "Post");
                verifyPost(post, response);
        }
 
@@ -73,7 +73,7 @@ public class GetPostCommandTest {
                                .put("Post", "PostId")
                                .get();
                Response response = getPostCommand.execute(getPostFieldSet, null, DIRECT);
-               verifyAnswer(response);
+               verifyAnswer(response, "Post");
                verifyPost(post, response);
        }
 
@@ -81,9 +81,9 @@ public class GetPostCommandTest {
        public void verifyThatGettingAPostWithRepliesWorks() throws FcpException, FSParseException {
                Sone sone = mocks.mockSone("SoneId").create();
                Post post = preparePostWithoutRecipient(sone);
-               PostReply postReply1 = mocks.mockPostReply(sone, "Reply1");
+               PostReply postReply1 = mocks.mockPostReply(sone, "Reply1").create();
                when(postReply1.getText()).thenReturn("Reply 1.");
-               PostReply postReply2 = mocks.mockPostReply(sone, "Reply2");
+               PostReply postReply2 = mocks.mockPostReply(sone, "Reply2").create();
                when(postReply2.getText()).thenReturn("Reply 2.");
                when(post.getReplies()).thenReturn(asList(postReply1, postReply2));
                SimpleFieldSet getPostFieldSet = new SimpleFieldSetBuilder()
@@ -92,7 +92,7 @@ public class GetPostCommandTest {
                                .put("IncludeReplies", "true")
                                .get();
                Response response = getPostCommand.execute(getPostFieldSet, null, DIRECT);
-               verifyAnswer(response);
+               verifyAnswer(response, "Post");
                verifyPost(post, response);
                assertThat(response.getReplyParameters().getInt("Post.Replies.Count"), is(post.getReplies().size()));
                verifyReply(response.getReplyParameters(), "Post.Replies.0.", postReply1);
@@ -138,10 +138,10 @@ public class GetPostCommandTest {
                return post;
        }
 
-       private void verifyAnswer(Response response) {
+       private void verifyAnswer(Response response, String messageName) {
                assertThat(response, notNullValue());
                assertThat(response.getReplyParameters(), notNullValue());
-               assertThat(response.getReplyParameters().get("Message"), is("Post"));
+               assertThat(response.getReplyParameters().get("Message"), is(messageName));
        }
 
        private void verifyReply(SimpleFieldSet replyParameters, String prefix, PostReply postReply) throws FSParseException {