From aa5513efdffab4a204d9bea43d4e7820aa92da73 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 9 Feb 2014 12:37:14 +0100 Subject: [PATCH] Implement getLocalSone in mocked Core. --- 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 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 { -- 2.7.4