From 5bee7fb48ebff210d2b68f1939acbdb4ea10d1c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 4 Nov 2013 06:24:45 +0100 Subject: [PATCH] Store sones as a Map. --- src/test/java/net/pterodactylus/sone/data/Mocks.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/java/net/pterodactylus/sone/data/Mocks.java b/src/test/java/net/pterodactylus/sone/data/Mocks.java index 51a24fd..88baf22 100644 --- a/src/test/java/net/pterodactylus/sone/data/Mocks.java +++ b/src/test/java/net/pterodactylus/sone/data/Mocks.java @@ -21,8 +21,8 @@ import static com.google.common.base.Optional.absent; 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; @@ -31,6 +31,7 @@ import static org.mockito.Mockito.when; 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; @@ -53,7 +54,7 @@ import org.mockito.stubbing.Answer; public class Mocks { private final Multimap sonePosts = create(); - private final Collection sones = newHashSet(); + private final Map sones = newHashMap(); private final Multimap postReplies = create(); private final Multimap directedPosts = create(); public final Database database; @@ -65,7 +66,7 @@ public class Mocks { when(core.getLocalSones()).then(new Answer>() { @Override public Collection 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>() { @@ -184,7 +185,7 @@ public class Mocks { } }); when(mockedSone.toString()).thenReturn(String.format("Sone[%s]", id)); - sones.add(mockedSone); + sones.put(id, mockedSone); return mockedSone; } -- 2.7.4