From: David ‘Bombe’ Roden Date: Wed, 30 Oct 2013 21:24:02 +0000 (+0100) Subject: Move verifyAnswer method to Verifiers. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d1e15185426a5a66a1d67fd0ba24fcacf17df556;p=Sone.git Move verifyAnswer method to Verifiers. --- diff --git a/src/test/java/net/pterodactylus/sone/fcp/GetPostCommandTest.java b/src/test/java/net/pterodactylus/sone/fcp/GetPostCommandTest.java index 2c72cdf..6cd74a1 100644 --- a/src/test/java/net/pterodactylus/sone/fcp/GetPostCommandTest.java +++ b/src/test/java/net/pterodactylus/sone/fcp/GetPostCommandTest.java @@ -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())); diff --git a/src/test/java/net/pterodactylus/sone/fcp/Verifiers.java b/src/test/java/net/pterodactylus/sone/fcp/Verifiers.java index 82f28d9..c90edb2 100644 --- a/src/test/java/net/pterodactylus/sone/fcp/Verifiers.java +++ b/src/test/java/net/pterodactylus/sone/fcp/Verifiers.java @@ -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()));