Add method to mock post replies, too.
[Sone.git] / src / test / java / net / pterodactylus / sone / data / Mocks.java
index ba029b4..7ee612d 100644 (file)
@@ -54,6 +54,7 @@ public class Mocks {
                Database database = mock(Database.class);
                when(database.getSone(anyString())).thenReturn(Optional.<Sone>absent());
                when(database.getPost(anyString())).thenReturn(Optional.<Post>absent());
+               when(database.getPostReply(anyString())).thenReturn(Optional.<PostReply>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;
+       }
+
 }