org.springframework.web.bind.support.SessionStatus Java Examples
The following examples show how to use
org.springframework.web.bind.support.SessionStatus.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OrderController.java From spring-in-action-5-samples with Apache License 2.0 | 6 votes |
@PostMapping public String processOrder(@Valid Order order, Errors errors, SessionStatus sessionStatus, @AuthenticationPrincipal User user) { if (errors.hasErrors()) { return "orderForm"; } order.setUser(user); orderRepo.save(order); sessionStatus.setComplete(); return "redirect:/"; }
Example #2
Source File: OrderController.java From spring-in-action-5-samples with Apache License 2.0 | 6 votes |
@PostMapping public String processOrder(@Valid Order order, Errors errors, SessionStatus sessionStatus, @AuthenticationPrincipal User user) { if (errors.hasErrors()) { return "orderForm"; } order.setUser(user); orderRepo.save(order); sessionStatus.setComplete(); return "redirect:/"; }
Example #3
Source File: OrderController.java From spring-in-action-5-samples with Apache License 2.0 | 6 votes |
@PostMapping public String processOrder(@Valid Order order, Errors errors, SessionStatus sessionStatus, @AuthenticationPrincipal User user) { if (errors.hasErrors()) { return "orderForm"; } order.setUser(user); orderRepo.save(order); sessionStatus.setComplete(); return "redirect:/"; }
Example #4
Source File: WidgetControllerTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test public void updateWidget_valid() { final String widgetUrl = "http://example.com/widget"; WidgetImpl widget = new WidgetImpl("123", widgetUrl); widget.setTitle("WidgetImpl title"); widget.setType("OpenSocial"); widget.setDescription("Lorem ipsum"); BindingResult errors = new BeanPropertyBindingResult(widget, "widget"); SessionStatus sessionStatus = createMock(SessionStatus.class); ModelMap modelMap = new ExtendedModelMap(); expect(service.getWidgetByUrl(widgetUrl)).andReturn(widget); service.updateWidget(widget); sessionStatus.setComplete(); expectLastCall(); replay(service, sessionStatus); String view = controller.updateWidgetDetail(widget, errors, validToken, validToken,REFERRER_ID, modelMap, sessionStatus); verify(service, sessionStatus); assertFalse("No errors", errors.hasErrors()); assertEquals("redirect:/app/admin/widgets?action=update&referringPageId=" +REFERRER_ID, view); }
Example #5
Source File: OrderController.java From spring-in-action-5-samples with Apache License 2.0 | 6 votes |
@PostMapping public String processOrder(@Valid Order order, Errors errors, SessionStatus sessionStatus, @AuthenticationPrincipal User user) { if (errors.hasErrors()) { return "orderForm"; } UserUDT userUDT = new UserUDT(user.getUsername(), user.getFullname(), user.getPhoneNumber()); order.setUser(userUDT); orderRepo.save(order); sessionStatus.setComplete(); return "redirect:/"; }
Example #6
Source File: TagSearchController.java From wallride with Apache License 2.0 | 6 votes |
@RequestMapping(params = "query") public String search( @PathVariable String language, String query, Model model, SessionStatus sessionStatus, RedirectAttributes redirectAttributes) { sessionStatus.setComplete(); for (Map.Entry<String, Object> mapEntry : model.asMap().entrySet()) { redirectAttributes.addFlashAttribute(mapEntry.getKey(), mapEntry.getValue()); } String url = UriComponentsBuilder.fromPath("/_admin/{language}/tags/index") .query(query) .buildAndExpand(language) .encode() .toUriString(); return "redirect:" + url; }
Example #7
Source File: UserControllerTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test(expected = SecurityException.class) public void deleteUserDetail_wrongToken() { ModelMap modelMap = new ExtendedModelMap(); User user = new UserImpl("123", "john.doe.sr"); SessionStatus sessionStatus = createMock(SessionStatus.class); sessionStatus.setComplete(); expectLastCall(); replay(sessionStatus); String otherToken = AdminControllerUtil.generateSessionToken(); controller.deleteUserDetail(user, validToken, otherToken, "true",REFERRER_ID, modelMap, sessionStatus); verify(sessionStatus); assertFalse("SecurityException", true); }
Example #8
Source File: CategoryController.java From attic-rave with Apache License 2.0 | 6 votes |
@RequestMapping(value = {"/admin/category/create"}, method = RequestMethod.POST) public String createCategory(@ModelAttribute CategoryImpl category, @ModelAttribute(ModelKeys.TOKENCHECK) String sessionToken, @RequestParam String token, @RequestParam(required = false) String referringPageId, Model model, SessionStatus status) { checkTokens(sessionToken, token, status); User creator = userService.getAuthenticatedUser(); boolean isValidRequest = validateRequest(category.getText(), creator); if (isValidRequest) { categoryService.create(category.getText(), creator); } else { model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId); addNavigationMenusToModel(SELECTED_ITEM, model, referringPageId); return ViewNames.ADMIN_CATEGORIES; } status.setComplete(); return "redirect:/app/admin/categories?action=create&referringPageId=" + referringPageId; }
Example #9
Source File: CategoryControllerTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test public void updateCategory_invalidValidRequest_nullWidgetToUpdate(){ Model model = new ExtendedModelMap(); User user = new UserImpl(); String id = "1"; String categoryText = "Social"; CategoryImpl category = new CategoryImpl(); category.setCreatedUserId(user.getId()); category.setText(categoryText); category.setId(id); SessionStatus sessionStatus = createMock(SessionStatus.class); expect(userService.getAuthenticatedUser()).andReturn(user).once(); expect(categoryService.get(id)).andReturn(null).once(); replay(userService, categoryService); String view = controller.updateCategory(category, validToken, validToken, REFERRER_ID, model, sessionStatus); assertEquals("ViewName match", ViewNames.ADMIN_CATEGORY_DETAIL, view); assertFalse("empty model", model.asMap().isEmpty()); verify(userService, categoryService); }
Example #10
Source File: CustomFieldSearchController.java From wallride with Apache License 2.0 | 6 votes |
@RequestMapping(params = "query") public String search( @PathVariable String language, String query, Model model, SessionStatus sessionStatus, RedirectAttributes redirectAttributes) { sessionStatus.setComplete(); for (Map.Entry<String, Object> mapEntry : model.asMap().entrySet()) { redirectAttributes.addFlashAttribute(mapEntry.getKey(), mapEntry.getValue()); } String url = UriComponentsBuilder.fromPath("/_admin/{language}/customfields/index") .query(query) .buildAndExpand(language) .encode() .toUriString(); return "redirect:" + url; }
Example #11
Source File: PortalPreferenceControllerTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test public void testUpdatePreferences_invalidPageSizeValue() { ModelMap model = new ExtendedModelMap(); HashMap<String, PortalPreference> preferenceMap = new HashMap<String, PortalPreference>(); PortalPreference pageSizePref = new PortalPreferenceImpl(PortalPreferenceKeys.PAGE_SIZE, "invalid"); preferenceMap.put(PortalPreferenceKeys.PAGE_SIZE, pageSizePref); PortalPreferenceForm form = new PortalPreferenceForm(preferenceMap); final BindingResult errors = new BeanPropertyBindingResult(form, "form"); SessionStatus sessionStatus = createMock(SessionStatus.class); replay(service, sessionStatus); String view = controller.updatePreferences(form, errors, validToken, validToken,REFERRER_ID, model, sessionStatus); assertEquals(ViewNames.ADMIN_PREFERENCE_DETAIL, view); assertTrue(errors.hasErrors()); assertTrue(model.containsAttribute("topnav")); assertTrue(model.containsAttribute("tabs")); assertFalse("Model has not been cleared", model.isEmpty()); verify(service, sessionStatus); }
Example #12
Source File: ArticleSearchController.java From wallride with Apache License 2.0 | 6 votes |
@RequestMapping(params = "query") public String search( @PathVariable String language, String query, Model model, SessionStatus sessionStatus, RedirectAttributes redirectAttributes) { sessionStatus.setComplete(); for (Map.Entry<String, Object> mapEntry : model.asMap().entrySet()) { redirectAttributes.addFlashAttribute(mapEntry.getKey(), mapEntry.getValue()); } String url = UriComponentsBuilder.fromPath("/_admin/{language}/articles/index") .query(query) .buildAndExpand(language) .encode() .toUriString(); return "redirect:" + url; }
Example #13
Source File: CategoryControllerTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test(expected = SecurityException.class) public void updateCategory_invalidToken(){ Model model = new ExtendedModelMap(); User user = new UserImpl(); String id = "1"; String categoryText = "Social"; String invalidToken = AdminControllerUtil.generateSessionToken(); CategoryImpl category = new CategoryImpl(); category.setCreatedUserId(user.getId()); category.setText(categoryText); category.setId(id); SessionStatus sessionStatus = createMock(SessionStatus.class); expect(userService.getAuthenticatedUser()).andReturn(user).once(); expect(categoryService.get(id)).andReturn(category); expect(categoryService.update(id, categoryText, user)).andReturn(category); sessionStatus.setComplete(); expectLastCall(); replay(userService, categoryService,sessionStatus); String view = controller.updateCategory(category, validToken, invalidToken,REFERRER_ID, model, sessionStatus);assertTrue("Test should catch exception and never hit this test", false); assertTrue("Test should catch exception and never hit this test", false); }
Example #14
Source File: CategoryControllerTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test public void createCategory_valid(){ Model model = new ExtendedModelMap(); User user = new UserImpl(); String categoryText = "Social"; CategoryImpl category = new CategoryImpl(); category.setText(categoryText); SessionStatus sessionStatus = createMock(SessionStatus.class); expect(userService.getAuthenticatedUser()).andReturn(user).once(); expect(categoryService.create(categoryText, user)).andReturn(new CategoryImpl()); sessionStatus.setComplete(); expectLastCall(); replay(userService, categoryService,sessionStatus); String view = controller.createCategory(category, validToken, validToken,REFERRER_ID, model, sessionStatus); assertEquals("ViewName match", "redirect:/app/admin/categories?action=create&referringPageId=" +REFERRER_ID, view); assertTrue("empty model", model.asMap().isEmpty()); verify(userService, categoryService, sessionStatus); }
Example #15
Source File: OrderController.java From spring-in-action-5-samples with Apache License 2.0 | 6 votes |
@PostMapping public String processOrder(@Valid Order order, Errors errors, SessionStatus sessionStatus, @AuthenticationPrincipal User user) { if (errors.hasErrors()) { return "orderForm"; } order.setUser(user); orderRepo.save(order); sessionStatus.setComplete(); return "redirect:/"; }
Example #16
Source File: UserController.java From attic-rave with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/admin/userdetail/delete", method = RequestMethod.POST) public 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) { checkTokens(sessionToken, token, status); if (!Boolean.parseBoolean(confirmdelete)) { modelMap.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId); AdminControllerUtil.addNavigationMenusToModel(SELECTED_ITEM, (Model) modelMap, referringPageId); modelMap.addAttribute("missingConfirm", true); return ViewNames.ADMIN_USERDETAIL; } userService.deleteUser(user.getId()); modelMap.clear(); status.setComplete(); return "redirect:/app/admin/users?action=delete&referringPageId=" + referringPageId; }
Example #17
Source File: PdfAutomationController.java From website with GNU Affero General Public License v3.0 | 6 votes |
@RequestMapping(value = "/product", method = RequestMethod.POST) public String update(@ModelAttribute ToProduct toProduct, BindingResult result, Model model, SessionStatus sessionStatus) { if (result.hasErrors()) { return "pdf/product"; } Product product = toProduct.getProduct(); if (toProduct.getJacketImage() != null && !toProduct.getJacketImage().isEmpty()) { String jacketImageFilename; try { jacketImageFilename = saveJacketImageFile(toProduct.getJacketImage()); } catch (Exception e) { result.reject(e.getMessage()); return "pdf/product"; } product.setJacketImageFilename(FilenameUtils.getName(jacketImageFilename)); } PdfConversion pdfConversion = toProduct.getPdfConversion(); product = product.merge(); pdfConversion.setProduct(product); pdfConversion.merge(); sessionStatus.setComplete(); return "redirect:/product/update/" + product.getId(); }
Example #18
Source File: WidgetController.java From attic-rave with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/admin/widgetdetail/update", method = RequestMethod.POST) public String updateWidgetDetail(@ModelAttribute(ModelKeys.WIDGET) Widget widget, BindingResult result, @ModelAttribute(ModelKeys.TOKENCHECK) String sessionToken, @RequestParam String token, @RequestParam(required = false) String referringPageId, ModelMap modelMap, SessionStatus status) { checkTokens(sessionToken, token, status); widgetValidator.validate(widget, result); if (result.hasErrors()) { addNavigationMenusToModel(SELECTED_ITEM, (Model) modelMap, referringPageId); modelMap.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId); modelMap.addAttribute(ModelKeys.CATEGORIES, categoryService.getAllList()); return ViewNames.ADMIN_WIDGETDETAIL; } widgetService.updateWidget(widget); modelMap.clear(); status.setComplete(); return "redirect:/app/admin/widgets?action=update&referringPageId=" + referringPageId; }
Example #19
Source File: ResetPasswordHtmlController.java From spring-boot-doma2-sample with Apache License 2.0 | 6 votes |
/** * パスワード変更 更新処理 * * @param form * @param result * @param sessionStatus * @param attributes * @return */ @PostMapping(CHANGE_PASSWORD_URL) public String changePassword(@Validated @ModelAttribute ChangePasswordForm form, BindingResult result, SessionStatus sessionStatus, RedirectAttributes attributes) { // 入力チェックエラーがある場合は、元の画面にもどる if (result.hasErrors()) { setFlashAttributeErrors(attributes, result); return StringUtils.join("redirect:/changePassword?token=", form.getToken()); } val token = form.getToken(); val password = passwordEncoder.encode(form.getPassword()); // 有効性をチェックする if (loginService.updatePassword(token, password)) { // セッションのChangePasswordFormをクリアする sessionStatus.setComplete(); return "redirect:/changePassword?done"; } else { return "redirect:/changePassword"; } }
Example #20
Source File: CodeHtmlController.java From spring-boot-doma2-sample with Apache License 2.0 | 6 votes |
/** * 編集画面 更新処理 * * @param form * @param br * @param codeId * @param sessionStatus * @param attributes * @return */ @PostMapping("/edit/{codeId}") public String editCode(@Validated @ModelAttribute("codeForm") CodeForm form, BindingResult br, @PathVariable Long codeId, SessionStatus sessionStatus, RedirectAttributes attributes) { // 入力チェックエラーがある場合は、元の画面にもどる if (br.hasErrors()) { setFlashAttributeErrors(attributes, br); return "redirect:/system/codes/edit/" + codeId; } // 更新対象を取得する val code = codeService.findById(codeId); // 入力値を詰め替える modelMapper.map(form, code); // 更新する val updatedCode = codeService.update(code); // セッションのcodeFormをクリアする sessionStatus.setComplete(); return "redirect:/system/codes/show/" + updatedCode.getId(); }
Example #21
Source File: CategoryControllerTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test public void deleteCategory_invalidValidRequest_emptyText(){ Model model = new ExtendedModelMap(); User user = new UserImpl(); String id = "1"; String categoryText = ""; CategoryImpl category = new CategoryImpl(); category.setCreatedUserId(user.getId()); category.setText(categoryText); category.setId(id); SessionStatus sessionStatus = createMock(SessionStatus.class); expect(userService.getAuthenticatedUser()).andReturn(user).once(); replay(userService); String view = controller.deleteCategory(category, validToken, validToken, "true",REFERRER_ID, model, sessionStatus); assertEquals("ViewName match", ViewNames.ADMIN_CATEGORY_DETAIL, view); assertFalse("empty model", model.asMap().isEmpty()); verify(userService); }
Example #22
Source File: PublisherEarningController.java From website with GNU Affero General Public License v3.0 | 6 votes |
@RequestMapping(value = "/publisher-earnings/payment-details", method = RequestMethod.POST) public String paymentRequestDetails(@ModelAttribute PublisherPaymentDetails publisherPaymentDetails, Model model, BindingResult result, SessionStatus sessionStatus, RedirectAttributes redirectAttributes) { if (result.hasErrors()) { model.addAttribute("publisherPaymentDetails", publisherPaymentDetails); return "publisher-payment-details"; } publisherPaymentDetails.merge(); sessionStatus.setComplete(); User user = AuthenticationService.currentActingUser(); PublisherEarningSearch publisherEarningSearch = (PublisherEarningSearch) model.asMap().get("publisherEarningSearchFlash"); if (publisherEarningSearch != null) { requestPayment(publisherEarningSearch, user); return "redirect:/publisher-earnings/payment-requests"; } return "redirect:/account"; }
Example #23
Source File: CategoryControllerTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test(expected = SecurityException.class) public void createCategory_invalidToken(){ Model model = new ExtendedModelMap(); String invalidToken = AdminControllerUtil.generateSessionToken(); User user = new UserImpl(); String categoryText = "Social"; CategoryImpl category = new CategoryImpl(); category.setText(categoryText); SessionStatus sessionStatus = createMock(SessionStatus.class); expect(userService.getAuthenticatedUser()).andReturn(user).once(); expect(categoryService.create(categoryText, user)).andReturn(new CategoryImpl()); sessionStatus.setComplete(); expectLastCall(); replay(userService, categoryService,sessionStatus); String view = controller.createCategory(category, validToken, invalidToken,REFERRER_ID, model, sessionStatus); assertTrue("Test should catch exception and never hit this test", false); }
Example #24
Source File: MailTemplateHtmlController.java From spring-boot-doma2-sample with Apache License 2.0 | 6 votes |
/** * 編集画面 更新処理 * * @param form * @param br * @param mailTemplateId * @param sessionStatus * @param attributes * @return */ @PostMapping("/edit/{mailTemplateId}") public String editMailtemplate(@Validated @ModelAttribute("mailTemplateForm") MailTemplateForm form, BindingResult br, @PathVariable Long mailTemplateId, SessionStatus sessionStatus, RedirectAttributes attributes) { // 入力チェックエラーがある場合は、元の画面にもどる if (br.hasErrors()) { setFlashAttributeErrors(attributes, br); return "redirect:/system/mailtemplates/edit/" + mailTemplateId; } // 更新対象を取得する val mailTemplate = mailTemplateService.findById(mailTemplateId); // 入力値を詰め替える modelMapper.map(form, mailTemplate); // 更新する val updatedMailTemplate = mailTemplateService.update(mailTemplate); // セッションのmailTemplateFormをクリアする sessionStatus.setComplete(); return "redirect:/system/mailtemplates/show/" + updatedMailTemplate.getId(); }
Example #25
Source File: RoleHtmlController.java From spring-boot-doma2-sample with Apache License 2.0 | 6 votes |
/** * 編集画面 更新処理 * * @param form * @param br * @param roleId * @param sessionStatus * @param attributes * @return */ @PostMapping("/edit/{roleId}") public String editRole(@Validated @ModelAttribute("roleForm") RoleForm form, BindingResult br, @PathVariable Long roleId, SessionStatus sessionStatus, RedirectAttributes attributes) { // 入力チェックエラーがある場合は、元の画面にもどる if (br.hasErrors()) { setFlashAttributeErrors(attributes, br); return "redirect:/system/roles/edit/" + roleId; } // 更新対象を取得する val role = roleService.findById(roleId); // 入力値を詰め替える modelMapper.map(form, role); // 更新する val updatedRole = roleService.update(role); // セッションのroleFormをクリアする sessionStatus.setComplete(); return "redirect:/system/roles/show/" + updatedRole.getId(); }
Example #26
Source File: WidgetControllerTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test(expected = SecurityException.class) public void updateWidget_wrongToken() { WidgetImpl widget = new WidgetImpl(); BindingResult errors = new BeanPropertyBindingResult(widget, "widget"); SessionStatus sessionStatus = createMock(SessionStatus.class); ModelMap modelMap = new ExtendedModelMap(); sessionStatus.setComplete(); expectLastCall(); replay(sessionStatus); String otherToken = AdminControllerUtil.generateSessionToken(); controller.updateWidgetDetail(widget, errors, "sessionToken", otherToken,REFERRER_ID, modelMap, sessionStatus); verify(sessionStatus); assertFalse("Can't come here", true); }
Example #27
Source File: UserControllerTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test public void updateUserDetail_success() { ModelMap modelMap = new ExtendedModelMap(); String userid = "123"; final String email = "[email protected]"; UserImpl user = new UserImpl(userid, "john.doe.sr"); user.setPassword("secrect"); user.setConfirmPassword("secrect"); user.setEmail(email); final BindingResult errors = new BeanPropertyBindingResult(user, "user"); SessionStatus sessionStatus = createMock(SessionStatus.class); expect(userService.getUserByEmail(email)).andReturn(user); userService.updateUserProfile(user); sessionStatus.setComplete(); expectLastCall(); replay(userService, sessionStatus); final String view = controller.updateUserDetail(user, errors, validToken, validToken,REFERRER_ID, modelMap, sessionStatus); verify(userService, sessionStatus); assertFalse(errors.hasErrors()); assertEquals("redirect:/app/admin/users?action=update&referringPageId=" + REFERRER_ID, view); }
Example #28
Source File: CategoryControllerTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test public void updateCategory_invalidValidRequest_nullUser(){ Model model = new ExtendedModelMap(); String id = "1"; User user = new UserImpl(); String categoryText = "Social"; CategoryImpl category = new CategoryImpl(); category.setCreatedUserId(user.getId()); category.setText(categoryText); category.setId(id); SessionStatus sessionStatus = createMock(SessionStatus.class); expect(userService.getAuthenticatedUser()).andReturn(user).once(); replay(userService); String view = controller.updateCategory(category, validToken, validToken,REFERRER_ID, model, sessionStatus); assertEquals("ViewName match", ViewNames.ADMIN_CATEGORY_DETAIL, view); assertFalse("empty model", model.asMap().isEmpty()); verify(userService); }
Example #29
Source File: PortalPreferenceControllerTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test(expected = SecurityException.class) public void testUpdatePreferences_invalidToken() { ModelMap model = new ExtendedModelMap(); String invalidToken = AdminControllerUtil.generateSessionToken(); PortalPreferenceForm form = new PortalPreferenceForm(new HashMap<String, PortalPreference>()); final BindingResult errors = new BeanPropertyBindingResult(form, "form"); SessionStatus sessionStatus = createMock(SessionStatus.class); sessionStatus.setComplete(); expectLastCall(); replay(service, sessionStatus); controller.updatePreferences(form, errors, validToken, invalidToken,REFERRER_ID, model, sessionStatus); assertFalse("Should not end up here", true); verify(service, sessionStatus); }
Example #30
Source File: CategoryControllerTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test public void deleteCategory_valid(){ Model model = new ExtendedModelMap(); User user = new UserImpl(); String id = "1"; String categoryText = "Social"; CategoryImpl category = new CategoryImpl(); category.setCreatedUserId(user.getId()); category.setText(categoryText); category.setId(id); SessionStatus sessionStatus = createMock(SessionStatus.class); expect(userService.getAuthenticatedUser()).andReturn(user).once(); expect(categoryService.get(id)).andReturn(category).anyTimes(); categoryService.delete(category); expectLastCall(); sessionStatus.setComplete(); expectLastCall(); replay(userService, categoryService,sessionStatus); String view = controller.deleteCategory(category, validToken, validToken, "true",REFERRER_ID, model,sessionStatus); assertEquals("ViewName match", "redirect:/app/admin/categories?action=delete&referringPageId=" + REFERRER_ID, view); assertTrue("empty model", model.asMap().isEmpty()); verify(userService, categoryService, sessionStatus); }