From d1e15185426a5a66a1d67fd0ba24fcacf17df556 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 30 Oct 2013 22:24:02 +0100 Subject: [PATCH] Move verifyAnswer method to Verifiers. --- src/test/java/net/pterodactylus/sone/fcp/GetPostCommandTest.java | 8 +------- src/test/java/net/pterodactylus/sone/fcp/Verifiers.java | 8 ++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) 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())); -- 2.7.4