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());