From: David ‘Bombe’ Roden Date: Mon, 28 Oct 2013 18:21:00 +0000 (+0100) Subject: Add method to mock post replies, too. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=19e22f01b97b13c88a67b0e18c3dcae5d652c915;p=Sone.git Add method to mock post replies, too. --- 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; + } + }