### Question:
UserController { @ModelAttribute("authorities") public SearchResult<Authority> populateAuthorityList() { return authorityService.getAllAuthorities(); }  @InitBinder(value = {"user"}) void initBinder(WebDataBinder dataBinder); @RequestMapping(value = {"/admin/users"}, method = RequestMethod.GET) String viewUsers(@RequestParam(required = false, defaultValue = "0") int offset,
                            @RequestParam(required = false) final String action,
                            @RequestParam(required = false) String referringPageId,
                            Model model); @RequestMapping(value = "/admin/users/search", method = RequestMethod.GET) String searchUsers(@RequestParam(required = true) String searchTerm,
                              @RequestParam(required = false, defaultValue = "0") int offset,
                              @RequestParam(required = false) String referringPageId,Model model); @RequestMapping(value = "/admin/userdetail/{userid}", method = RequestMethod.GET) String viewUserDetail(@PathVariable("userid") String userid,
                                 @RequestParam(required = false) String referringPageId,
                                 Model model); @RequestMapping(value = "/admin/userdetail/update", method = RequestMethod.POST) String updateUserDetail(@ModelAttribute User user, BindingResult result,
                                   @ModelAttribute(ModelKeys.TOKENCHECK) String sessionToken,
                                   @RequestParam() String token,
                                   @RequestParam(required = false) String referringPageId,
                                   ModelMap modelMap,
                                   SessionStatus status); @RequestMapping(value = "/admin/userdetail/delete", method = RequestMethod.POST) String deleteUserDetail(@ModelAttribute User user,
                                   @ModelAttribute(ModelKeys.TOKENCHECK) String sessionToken,
                                   @RequestParam String token,
                                   @RequestParam(required = false) String confirmdelete,
                                   @RequestParam(required = false) String referringPageId,
                                   ModelMap modelMap,
                                   SessionStatus status); @RequestMapping(method = RequestMethod.GET, value = {"/admin/adduser"}) String setUpForm(ModelMap model, @RequestParam(required = false) String referringPageId); @RequestMapping(value = {"/admin/newaccount", "/admin/newaccount/*"}, method = RequestMethod.POST) String create(@ModelAttribute(value = "newUser") UserForm newUser, BindingResult results, Model model,
                         @RequestParam(required = false) String referringPageId,
                         RedirectAttributes redirectAttributes); @ModelAttribute("authorities") SearchResult<Authority> populateAuthorityList(); @ModelAttribute("loggedInUser") String populateLoggedInUsername(); int getPageSize();  }### Answer:
@Test public void getAuthoritiesForModelMap() { final SearchResult<Authority> authorities = createSearchResultWithTwoAuthorities(); expect(authorityService.getAllAuthorities()).andReturn(authorities); replay(authorityService); final SearchResult<Authority> result = controller.populateAuthorityList(); verify(authorityService); assertEquals(authorities, result); }