@Test
  public void testGetPostsInTopic() throws Exception {
    Topic topic = new Topic();
    int pageNumber = 5;

    Page<Post> expectedPage = new PageImpl<Post>(new ArrayList<Post>());
    when(postDao.getPostsInTopic(topic, new PageRequest(pageNumber, PAGE_SIZE.STANDARD.getSize())))
        .thenReturn(expectedPage);

    Page<Post> actualPage = postService.getPostsInTopic(topic, pageNumber);
    assertSame(expectedPage, actualPage);
  }
  @Test
  public void testGetAllPostsInBranch() throws Exception {
    Branch branch = new Branch("name", "description");
    Post post = new Post();
    List<Post> postList = new ArrayList<>();
    postList.add(post);

    when(postDao.getPostsInBranch(branch)).thenReturn(postList);

    List<Post> actualPostList = branchService.getAllPostsInBranch(branch);

    assertEquals(postList.size(), actualPostList.size());
    assertSame(post, actualPostList.get(0));
  }
  @Test
  public void testFillBranchStatistics() {
    int expectedTopicCount = 5;
    int expectedPostCount = 10;
    Branch branch = new Branch("name", "description");

    when(topicDao.getTopicCountInBranch(branch)).thenReturn(expectedTopicCount);
    when(postDao.getPostCountInBranch(branch)).thenReturn(expectedPostCount);

    branchService.fillBranchStatistics(branch);

    assertEquals(expectedTopicCount, branch.getTopicsCount());
    assertEquals(expectedPostCount, branch.getPostsCount());
  }