From: David ‘Bombe’ Roden Date: Sun, 9 Feb 2014 11:37:14 +0000 (+0100) Subject: Implement getLocalSone in mocked Core. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=aa5513efdffab4a204d9bea43d4e7820aa92da73;p=Sone.git Implement getLocalSone in mocked Core. --- diff --git a/src/test/java/net/pterodactylus/sone/data/Mocks.java b/src/test/java/net/pterodactylus/sone/data/Mocks.java index 72a4e75..f56a1d4 100644 --- a/src/test/java/net/pterodactylus/sone/data/Mocks.java +++ b/src/test/java/net/pterodactylus/sone/data/Mocks.java @@ -101,6 +101,13 @@ public class Mocks { return sones.values(); } }); + when(core.getLocalSone(anyString())).then(new Answer>() { + @Override + public Optional answer(InvocationOnMock invocation) throws Throwable { + Sone localSone = sones.get(invocation.getArguments()[0]); + return ((localSone == null) || (!localSone.isLocal())) ? Optional.absent() : of(localSone); + } + }); when(core.getLocalSones()).then(new Answer>() { @Override public Collection answer(InvocationOnMock invocation) throws Throwable {