### Question:
BranchController { @RequestMapping("/branches/json/{currentTopicId}/{sectionId}") @ResponseBody public BranchDto[] getBranchesFromSection(@PathVariable("currentTopicId") long currentTopicId, @PathVariable("sectionId") long sectionId) throws NotFoundException { List<Branch> branches = branchService.getAvailableBranchesInSection(sectionId, currentTopicId); return convertBranchesListToBranchDtoArray(branches); } @Autowired  BranchController(BranchService branchService,
                            TopicFetchService topicFetchService,
                            LastReadPostService lastReadPostService,
                            UserService userService,
                            BreadcrumbBuilder breadcrumbBuilder,
                            LocationService locationService,
                            PostService postService,
                            PermissionEvaluator aclEvaluator,
                            SecurityContextFacade securityContextFacade,
                            PluginLoader pluginLoader,
                            EntityToDtoConverter converter); @RequestMapping(value = "/branches/{branchId}", method = RequestMethod.GET) ModelAndView showPage(@PathVariable("branchId") long branchId,
                                 @RequestParam(value = PAGE, defaultValue = "1", required = false) String page
    ); @RequestMapping("/branches/{branchId}/recent") ModelAndView recentBranchPostsPage(@PathVariable("branchId") long branchId); @RequestMapping("/topics/recent") ModelAndView recentTopicsPage(
            @RequestParam(value = PAGE, defaultValue = "1", required = false) String page); @RequestMapping("/topics/unanswered") ModelAndView unansweredTopicsPage(@RequestParam(value = PAGE, defaultValue = "1", required = false)
                                             String page); @RequestMapping("/branches/json/{currentTopicId}/{sectionId}") @ResponseBody BranchDto[] getBranchesFromSection(@PathVariable("currentTopicId") long currentTopicId,
                                              @PathVariable("sectionId") long sectionId); @RequestMapping("/branches/json/{currentTopicId}") @ResponseBody BranchDto[] getAllBranches(@PathVariable("currentTopicId") long currentTopicId); static final String PAGE; }### Answer:
@Test public void testGetBranchesFromSection() throws NotFoundException { long sectionId = 1L; List<Branch> branches = new ArrayList<>(); Branch branch = createDefaultBranch(); branches.add(branch); when(branchService.getAvailableBranchesInSection(sectionId, branch.getTopics().get(0).getId())).thenReturn(branches); BranchDto[] branchDtoArray = controller.getBranchesFromSection(sectionId, branch.getTopics().get(0).getId()); assertEquals(branchDtoArray.length, branches.size()); assertEquals(branchDtoArray[0].getId(), branch.getId()); assertEquals(branchDtoArray[0].getName(), branch.getName()); }