X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FCreatePostCommandTest.java;h=a424079976ae7b9532b8aa7dfc217472424b6899;hb=67d172414f70c588e878c64ec8ba43f388bc93bb;hp=f9cb1abeca7bd16210530d6bbf8fa6e7b04f598d;hpb=d1e15185426a5a66a1d67fd0ba24fcacf17df556;p=Sone.git diff --git a/src/test/java/net/pterodactylus/sone/fcp/CreatePostCommandTest.java b/src/test/java/net/pterodactylus/sone/fcp/CreatePostCommandTest.java index f9cb1ab..a424079 100644 --- a/src/test/java/net/pterodactylus/sone/fcp/CreatePostCommandTest.java +++ b/src/test/java/net/pterodactylus/sone/fcp/CreatePostCommandTest.java @@ -20,13 +20,13 @@ package net.pterodactylus.sone.fcp; import static com.google.common.base.Optional.of; import static java.lang.System.currentTimeMillis; import static net.pterodactylus.sone.database.PostBuilder.PostCreated; +import static net.pterodactylus.sone.fcp.Verifiers.verifyAnswer; import static net.pterodactylus.sone.freenet.fcp.Command.AccessType.DIRECT; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.lessThanOrEqualTo; -import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; import static org.mockito.Mockito.when; @@ -66,9 +66,7 @@ public class CreatePostCommandTest { .put("Recipient", "OtherSone") .get(); Response response = createPostCommand.execute(createPostFieldSet, null, DIRECT); - assertThat(response, notNullValue()); - assertThat(capturingPostCreated.post, notNullValue()); - assertThat(response.getReplyParameters().get("Message"), is("PostCreated")); + verifyAnswer(response, "PostCreated"); assertThat(response.getReplyParameters().get("Post"), is(capturingPostCreated.post.getId())); assertThat(capturingPostCreated.post.getSone(), is(sone)); assertThat(capturingPostCreated.post.getRecipientId(), is(of("OtherSone"))); @@ -87,9 +85,7 @@ public class CreatePostCommandTest { .put("Text", "Text of the post.") .get(); Response response = createPostCommand.execute(createPostFieldSet, null, DIRECT); - assertThat(response, notNullValue()); - assertThat(capturingPostCreated.post, notNullValue()); - assertThat(response.getReplyParameters().get("Message"), is("PostCreated")); + verifyAnswer(response, "PostCreated"); assertThat(response.getReplyParameters().get("Post"), is(capturingPostCreated.post.getId())); assertThat(capturingPostCreated.post.getSone(), is(sone)); assertThat(capturingPostCreated.post.getRecipientId(), is(Optional.absent())); @@ -109,8 +105,7 @@ public class CreatePostCommandTest { .put("Text", "Text of the post.") .get(); Response response = createPostCommand.execute(createPostFieldSet, null, DIRECT); - assertThat(response, notNullValue()); - assertThat(response.getReplyParameters().get("Message"), is("Error")); + verifyAnswer(response, "Error"); assertThat(capturingPostCreated.post, nullValue()); }