From 0e12efbf4845abffa937fd4b94caf24b1cfe05e1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 19 Feb 2014 18:14:23 +0100 Subject: [PATCH] Make mocked posts retrievable. --- src/test/java/net/pterodactylus/sone/data/Mocks.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/java/net/pterodactylus/sone/data/Mocks.java b/src/test/java/net/pterodactylus/sone/data/Mocks.java index 51fa239..845f7c3 100644 --- a/src/test/java/net/pterodactylus/sone/data/Mocks.java +++ b/src/test/java/net/pterodactylus/sone/data/Mocks.java @@ -52,6 +52,7 @@ import net.pterodactylus.sone.database.Database; import net.pterodactylus.sone.database.PostBuilder.PostCreated; import net.pterodactylus.sone.database.PostReplyBuilder; import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired; +import net.pterodactylus.sone.database.PostReplyBuilder.PostReplyCreated; import net.pterodactylus.sone.utils.IntegerRangePredicate; import net.pterodactylus.sone.web.WebInterface; import net.pterodactylus.sone.web.page.FreenetRequest; @@ -136,6 +137,17 @@ public class Mocks { sonePosts.put(post.getSone(), post); } })); + when(core.postReplyCreated()).then(new Answer>() { + @Override + public Optional answer(InvocationOnMock invocation) throws Throwable { + return Optional.of(new PostReplyCreated() { + @Override + public void postReplyCreated(PostReply postReply) { + postReplies.put(postReply.getPost().get(), postReply); + } + }); + } + }); Options options = createOptions(); when(core.getPreferences()).thenReturn(new Preferences(options)); when(database.getDirectedPosts(anyString())).then(new Answer>() { -- 2.7.4