From: David ‘Bombe’ Roden Date: Sun, 27 Oct 2013 21:15:18 +0000 (+0100) Subject: Add methods to mock a post. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=680e37c46752febf555a04334e98f1017fdfca17;p=Sone.git Add methods to mock a post. --- diff --git a/src/test/java/net/pterodactylus/sone/data/Mocks.java b/src/test/java/net/pterodactylus/sone/data/Mocks.java index 34b25f3..a1c1a71 100644 --- a/src/test/java/net/pterodactylus/sone/data/Mocks.java +++ b/src/test/java/net/pterodactylus/sone/data/Mocks.java @@ -52,6 +52,7 @@ public class Mocks { public static Database mockDatabase() { Database database = mock(Database.class); when(database.getSone(anyString())).thenReturn(Optional.absent()); + when(database.getPost(anyString())).thenReturn(Optional.absent()); return database; } @@ -73,4 +74,12 @@ public class Mocks { return sone; } + public static Post mockPost(Core core, String postId) { + Post post = mock(Post.class); + when(post.getId()).thenReturn(postId); + Database database = core.getDatabase(); + when(database.getPost(eq(postId))).thenReturn(of(post)); + return post; + } + }