### Question:
PostServiceImpl implements PostService { @Override @Transactional(readOnly = false) public Post save(Post post) { if (post.getId() != null) { final Post oldPost = postDao.findOne(post.getId()); if (oldPost != post) { oldPost.setTags(post.getTags()); post.getTags().clear(); } } return postDao.save(post); }  @Override Page<Post> getPost(Pageable page); @Override @Transactional(readOnly = false) Post save(Post post); @Override Post read(Long postId); @Override @Transactional(readOnly = false) void delete(Long postId); @Override long getNrOfPosts(); @Override List<User> getAllUsers(); @Override List<Tag> getAllActiveTags();  }### Answer:
@Test public void testSave() { final Post aPost = new Post(); when(postDao.save(any(Post.class))).thenReturn(aPost); final Post testPost = postService.save(new Post()); assertThat(testPost).isEqualTo(aPost); verify(postDao, times(1)).save(any(Post.class)); }