From 868b16cb87b3981d8affdfd73eb753ddc83cd3e8 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:54 +0100 Subject: [PATCH] Implement Database.getSone() function. --- src/test/java/net/pterodactylus/sone/data/Mocks.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/java/net/pterodactylus/sone/data/Mocks.java b/src/test/java/net/pterodactylus/sone/data/Mocks.java index 88baf22..cbe9844 100644 --- a/src/test/java/net/pterodactylus/sone/data/Mocks.java +++ b/src/test/java/net/pterodactylus/sone/data/Mocks.java @@ -39,6 +39,7 @@ import net.pterodactylus.sone.data.impl.DefaultPostReplyBuilder; import net.pterodactylus.sone.database.Database; import net.pterodactylus.sone.database.PostReplyBuilder; +import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.collect.FluentIterable; import com.google.common.collect.Multimap; @@ -63,6 +64,12 @@ public class Mocks { public Mocks() { database = mockDatabase(); core = mockCore(database); + when(database.getSone()).thenReturn(new Function>() { + @Override + public Optional apply(String soneId) { + return (soneId == null) ? Optional.absent() : fromNullable(sones.get(soneId)); + } + }); when(core.getLocalSones()).then(new Answer>() { @Override public Collection answer(InvocationOnMock invocation) throws Throwable { -- 2.7.4