From: David ‘Bombe’ Roden Date: Wed, 19 Feb 2014 17:14:23 +0000 (+0100) Subject: Make mocked posts retrievable. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0e12efbf4845abffa937fd4b94caf24b1cfe05e1;p=Sone.git Make mocked posts retrievable. --- 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>() {