Move verifyAnswer method to Verifiers.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 30 Oct 2013 21:24:02 +0000 (22:24 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 28 Feb 2014 21:25:51 +0000 (22:25 +0100)
src/test/java/net/pterodactylus/sone/fcp/GetPostCommandTest.java
src/test/java/net/pterodactylus/sone/fcp/Verifiers.java

index 2c72cdf..6cd74a1 100644 (file)
@@ -20,10 +20,10 @@ package net.pterodactylus.sone.fcp;
 import static com.google.common.base.Optional.of;
 import static java.lang.String.format;
 import static java.util.Arrays.asList;
+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.is;
-import static org.hamcrest.Matchers.notNullValue;
 import static org.mockito.Mockito.when;
 
 import net.pterodactylus.sone.data.Mocks;
@@ -138,12 +138,6 @@ public class GetPostCommandTest {
                return post;
        }
 
-       private void verifyAnswer(Response response, String messageName) {
-               assertThat(response, notNullValue());
-               assertThat(response.getReplyParameters(), notNullValue());
-               assertThat(response.getReplyParameters().get("Message"), is(messageName));
-       }
-
        private void verifyReply(SimpleFieldSet replyParameters, String prefix, PostReply postReply) throws FSParseException {
                assertThat(replyParameters.get(format("%sID", prefix)), is(postReply.getId()));
                assertThat(replyParameters.get(format("%sSone", prefix)), is(postReply.getSone().getId()));
index 82f28d9..c90edb2 100644 (file)
@@ -22,11 +22,13 @@ import static java.lang.String.format;
 import static net.pterodactylus.sone.data.Reply.FUTURE_REPLY_FILTER;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
 
 import java.util.Collection;
 
 import net.pterodactylus.sone.data.Post;
 import net.pterodactylus.sone.data.PostReply;
+import net.pterodactylus.sone.freenet.fcp.Command.Response;
 
 import freenet.node.FSParseException;
 import freenet.support.SimpleFieldSet;
@@ -40,6 +42,12 @@ import org.hamcrest.CoreMatchers;
  */
 public class Verifiers {
 
+       static void verifyAnswer(Response response, String messageName) {
+               assertThat(response, notNullValue());
+               assertThat(response.getReplyParameters(), notNullValue());
+               assertThat(response.getReplyParameters().get("Message"), is(messageName));
+       }
+
        static void verifyPost(SimpleFieldSet replyParameters, String prefix, Post post) throws FSParseException {
                assertThat(replyParameters.get(format("%sID", prefix)), is(post.getId()));
                assertThat(replyParameters.get(format("%sSone", prefix)), is(post.getSone().getId()));