import static com.google.common.base.Optional.fromNullable;
import static com.google.common.base.Optional.of;
import static com.google.common.collect.ArrayListMultimap.create;
+import static com.google.common.collect.Maps.newHashMap;
import static com.google.common.collect.Ordering.from;
-import static com.google.common.collect.Sets.newHashSet;
import static java.util.Collections.emptySet;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import java.util.Collection;
import java.util.List;
+import java.util.Map;
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.data.impl.DefaultPostBuilder;
public class Mocks {
private final Multimap<Sone, Post> sonePosts = create();
- private final Collection<Sone> sones = newHashSet();
+ private final Map<String, Sone> sones = newHashMap();
private final Multimap<Post, PostReply> postReplies = create();
private final Multimap<String, Post> directedPosts = create();
public final Database database;
when(core.getLocalSones()).then(new Answer<Collection<Sone>>() {
@Override
public Collection<Sone> answer(InvocationOnMock invocation) throws Throwable {
- return FluentIterable.from(sones).filter(Sone.LOCAL_SONE_FILTER).toList();
+ return FluentIterable.from(sones.values()).filter(Sone.LOCAL_SONE_FILTER).toList();
}
});
when(database.getDirectedPosts(anyString())).then(new Answer<Collection<Post>>() {
}
});
when(mockedSone.toString()).thenReturn(String.format("Sone[%s]", id));
- sones.add(mockedSone);
+ sones.put(id, mockedSone);
return mockedSone;
}