From e6261cf2053c7eff6856b88e420267230c6a9990 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 28 Oct 2013 22:07:48 +0100 Subject: [PATCH] Split Sone mocking back into two separate methods again. --- src/test/java/net/pterodactylus/sone/data/Mocks.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/test/java/net/pterodactylus/sone/data/Mocks.java b/src/test/java/net/pterodactylus/sone/data/Mocks.java index 0315365..5181f04 100644 --- a/src/test/java/net/pterodactylus/sone/data/Mocks.java +++ b/src/test/java/net/pterodactylus/sone/data/Mocks.java @@ -65,8 +65,10 @@ public class Mocks { } public static Sone mockLocalSone(Core core, final String id) { - Sone sone = mockRemoteSone(core, id); + final Sone sone = mock(Sone.class); + when(sone.getId()).thenReturn(id); when(sone.isLocal()).thenReturn(true); + when(sone.getProfile()).thenReturn(new Profile(sone)); final Database database = core.getDatabase(); when(sone.newPostBuilder()).thenReturn(new DefaultPostBuilder(database, id)); when(sone.newPostReplyBuilder(anyString())).then(new Answer() { @@ -75,6 +77,14 @@ public class Mocks { return new DefaultPostReplyBuilder(database, id, (String) invocation.getArguments()[0]); } }); + when(core.getSone(eq(id))).thenReturn(of(sone)); + when(database.getSone(eq(id))).thenReturn(of(sone)); + when(sone.getPosts()).then(new Answer>() { + @Override + public List answer(InvocationOnMock invocationOnMock) throws Throwable { + return from(TIME_COMPARATOR).sortedCopy(sonePosts.get(sone)); + } + }); return sone; } -- 2.7.4