Mock local Sones by mocking remote Sones and re-mocking some methods.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 28 Oct 2013 20:50:00 +0000 (21:50 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 28 Feb 2014 21:25:48 +0000 (22:25 +0100)
src/test/java/net/pterodactylus/sone/data/Mocks.java

index 7ee612d..fd95180 100644 (file)
@@ -59,8 +59,7 @@ public class Mocks {
        }
 
        public static Sone mockLocalSone(Core core, final String id) {
-               Sone sone = mock(Sone.class);
-               when(sone.getId()).thenReturn(id);
+               Sone sone = mockRemoteSone(core, id);
                when(sone.isLocal()).thenReturn(true);
                final Database database = core.getDatabase();
                when(sone.newPostBuilder()).thenReturn(new DefaultPostBuilder(database, id));
@@ -71,8 +70,6 @@ public class Mocks {
                                return new DefaultPostReplyBuilder(database, id, postIdCaptor.getValue());
                        }
                });
-               when(core.getSone(eq(id))).thenReturn(of(sone));
-               when(database.getSone(eq(id))).thenReturn(of(sone));
                return sone;
        }