@Test
  public void testAddPostToTopic() throws Exception {
    User user = new User();
    Topic topic = new Topic();
    Post submittedPost = new Post();

    when(userService.getCurrentUser()).thenReturn(user);

    postService.addPostToTopic(submittedPost, topic);

    assertSame(user, submittedPost.getUserCreated());
    assertSame(submittedPost, topic.getLastPost());
    assertSame(topic, submittedPost.getTopic());
  }
  @Test
  public void testCalculatePostPage() throws Exception {
    Topic topic = new Topic();
    for (int i = 0; i < 3 * PAGE_SIZE.STANDARD.getSize(); i++) {
      Post post = new Post();
      post.setPostContent("" + i);
      topic.addPost(post);
    }

    Post firstPost = topic.getPosts().get(0);
    Post lastPost = topic.getLastPost();

    int firstPostPageNumber = postService.calculatePostPage(firstPost);
    int lastPostPageNumber = postService.calculatePostPage(lastPost);

    assertEquals(0, firstPostPageNumber);
    assertEquals(2, lastPostPageNumber);
  }