From: David ‘Bombe’ Roden Date: Mon, 4 Nov 2013 05:24:54 +0000 (+0100) Subject: Implement Database.getSone() function. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=868b16cb87b3981d8affdfd73eb753ddc83cd3e8;p=Sone.git Implement Database.getSone() function. --- 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 {