private final Multimap<Sone, Post> sonePosts = create();
private final Collection<Sone> sones = newHashSet();
private final Multimap<Post, PostReply> postReplies = create();
+ private final Multimap<String, Post> directedPosts = create();
public final Database database;
public final Core core;
return FluentIterable.from(sones).filter(Sone.LOCAL_SONE_FILTER).toList();
}
});
+ when(database.getDirectedPosts(anyString())).then(new Answer<Collection<Post>>() {
+ @Override
+ public Collection<Post> answer(InvocationOnMock invocation) throws Throwable {
+ return directedPosts.get((String) invocation.getArguments()[0]);
+ }
+ });
}
private static Core mockCore(Database database) {
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());