+ 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);
+ }
+ });
+ }
+ });