+ when(core.postCreated()).thenReturn(Optional.<PostCreated>of(new PostCreated() {
+ @Override
+ public void postCreated(Post post) {
+ posts.put(post.getId(), post);
+ sonePosts.put(post.getSone(), post);
+ }
+ }));
+ when(core.postReplyCreated()).then(new Answer<Optional<PostReplyCreated>>() {
+ @Override
+ public Optional<PostReplyCreated> answer(InvocationOnMock invocation) throws Throwable {
+ return Optional.<PostReplyCreated>of(new PostReplyCreated() {
+ @Override
+ public void postReplyCreated(PostReply postReply) {
+ postReplies.put(postReply.getPost().get(), postReply);
+ }
+ });
+ }
+ });