### Question:
CategoryController { @RequestMapping(value = "/admin/category/edit", method = RequestMethod.GET) public String editCategory(@RequestParam(required = true) String id, @RequestParam(required = false) String referringPageId,Model model) { model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId); addNavigationMenusToModel(SELECTED_ITEM, model, referringPageId); model.addAttribute(ModelKeys.TOKENCHECK, AdminControllerUtil.generateSessionToken()); model.addAttribute(ModelKeys.CATEGORY, categoryService.get(id)); return ViewNames.ADMIN_CATEGORY_DETAIL; }  @RequestMapping(value = {"/admin/categories", "/admin/categories/"}, method = RequestMethod.GET) String getCategories(@RequestParam(required = false) final String action,
                                @RequestParam(required = false) String referringPageId,Model model); @RequestMapping(value = {"/admin/category/create"}, method = RequestMethod.POST) String createCategory(@ModelAttribute CategoryImpl category,
                                 @ModelAttribute(ModelKeys.TOKENCHECK) String sessionToken,
                                 @RequestParam String token,
                                 @RequestParam(required = false) String referringPageId,
                                 Model model,
                                 SessionStatus status); @RequestMapping(value = {"/admin/category/update"}, method = RequestMethod.POST) String updateCategory(@ModelAttribute(ModelKeys.CATEGORY) Category category,
                                 @ModelAttribute(ModelKeys.TOKENCHECK) String sessionToken,
                                 @RequestParam String token,
                                 @RequestParam(required = false) String referringPageId,
                                 Model model,
                                 SessionStatus status); @RequestMapping(value = {"/admin/category/delete"}, method = RequestMethod.POST) String deleteCategory(@ModelAttribute(ModelKeys.CATEGORY) Category category,
                                 @ModelAttribute(ModelKeys.TOKENCHECK) String sessionToken,
                                 @RequestParam String token,
                                 @RequestParam(required = false) String confirmdelete,
                                 @RequestParam(required = false) String referringPageId,
                                 Model model,
                                 SessionStatus status); @RequestMapping(value = "/admin/category/edit", method = RequestMethod.GET) String editCategory(@RequestParam(required = true) String id,
                               @RequestParam(required = false) String referringPageId,Model model); void setUserService(UserService userService); void setCategoryService(CategoryService categoryService);  }### Answer:
@Test public void editCategory_valid () { User user = new UserImpl(); String id = "1"; String categoryText = "Social"; Model model = new ExtendedModelMap(); CategoryImpl category = new CategoryImpl(); category.setCreatedUserId(user.getId()); category.setText(categoryText); category.setId(id); expect(categoryService.get(id)).andReturn(category).once(); replay(categoryService); String view = controller.editCategory(id,REFERRER_ID, model); assertEquals("ViewName match", ViewNames.ADMIN_CATEGORY_DETAIL, view); assertFalse("model is not empty", model.asMap().isEmpty()); assertSame("check model object", category, model.asMap().get("category")); assertTrue("verify tokencheck", model.asMap().containsKey(ModelKeys.TOKENCHECK)); verify(categoryService); }