From 680e37c46752febf555a04334e98f1017fdfca17 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 27 Oct 2013 22:15:18 +0100 Subject: [PATCH] Add methods to mock a post. --- src/test/java/net/pterodactylus/sone/data/Mocks.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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; + } + } -- 2.7.4