public static Database mockDatabase() {
Database database = mock(Database.class);
when(database.getSone(anyString())).thenReturn(Optional.<Sone>absent());
+ when(database.getPost(anyString())).thenReturn(Optional.<Post>absent());
return database;
}
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;
+ }
+
}