From 19e22f01b97b13c88a67b0e18c3dcae5d652c915 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 28 Oct 2013 19:21:00 +0100 Subject: [PATCH] Add method to mock post replies, too. --- src/test/java/net/pterodactylus/sone/data/Mocks.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/java/net/pterodactylus/sone/data/Mocks.java b/src/test/java/net/pterodactylus/sone/data/Mocks.java index ba029b4..7ee612d 100644 --- a/src/test/java/net/pterodactylus/sone/data/Mocks.java +++ b/src/test/java/net/pterodactylus/sone/data/Mocks.java @@ -54,6 +54,7 @@ public class Mocks { Database database = mock(Database.class); when(database.getSone(anyString())).thenReturn(Optional.absent()); when(database.getPost(anyString())).thenReturn(Optional.absent()); + when(database.getPostReply(anyString())).thenReturn(Optional.absent()); return database; } @@ -96,4 +97,13 @@ public class Mocks { return post; } + public static PostReply mockPostReply(Core core, Sone sone, String replyId) { + PostReply postReply = mock(PostReply.class); + when(postReply.getId()).thenReturn(replyId); + when(postReply.getSone()).thenReturn(sone); + Database database = core.getDatabase(); + when(database.getPostReply(eq(replyId))).thenReturn(of(postReply)); + return postReply; + } + } -- 2.7.4