+ public class PostMocker {
+
+ private final Post post = mock(Post.class);
+ private final String id;
+ private final Sone sone;
+
+ public PostMocker(String id, Sone sone) {
+ this.id = id;
+ this.sone = sone;
+ }
+
+ public Post create() {
+ when(post.getId()).thenReturn(id);
+ when(post.getSone()).thenReturn(sone);
+ when(database.getPost(eq(id))).thenReturn(of(post));
+ sonePosts.put(sone, post);
+ return post;
+ }
+
+ }
+