X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FMocks.java;h=51a24fd1c3b00649b9e193d97450e77b77ef8a68;hb=4ec09048a1e0dfbd8c8f8aeed550adb80cd6d7c6;hp=0aa6035640463c42c32651bb96403b94b65310e1;hpb=38aaaed4fa2430f157c024dd7eb0977289be1198;p=Sone.git diff --git a/src/test/java/net/pterodactylus/sone/data/Mocks.java b/src/test/java/net/pterodactylus/sone/data/Mocks.java index 0aa6035..51a24fd 100644 --- a/src/test/java/net/pterodactylus/sone/data/Mocks.java +++ b/src/test/java/net/pterodactylus/sone/data/Mocks.java @@ -55,6 +55,7 @@ public class Mocks { private final Multimap sonePosts = create(); private final Collection sones = newHashSet(); private final Multimap postReplies = create(); + private final Multimap directedPosts = create(); public final Database database; public final Core core; @@ -67,6 +68,12 @@ public class Mocks { return FluentIterable.from(sones).filter(Sone.LOCAL_SONE_FILTER).toList(); } }); + when(database.getDirectedPosts(anyString())).then(new Answer>() { + @Override + public Collection answer(InvocationOnMock invocation) throws Throwable { + return directedPosts.get((String) invocation.getArguments()[0]); + } + }); } private static Core mockCore(Database database) { @@ -216,6 +223,9 @@ public class Mocks { when(post.getId()).thenReturn(id); when(post.getSone()).thenReturn(sone); when(post.getRecipientId()).thenReturn(recipientId); + if (recipientId.isPresent()) { + directedPosts.put(recipientId.get(), post); + } when(post.getTime()).thenReturn(time); if (text.isPresent()) { when(post.getText()).thenReturn(text.get());