verify(userService, categoryService);
}
@Test
public void deleteCategory_valid(){
Model model = new ExtendedModelMap();
User user = new UserImpl();
long id = 1L;
String categoryText = "Social";
CategoryImpl category = new CategoryImpl();
category.setCreatedUser(user);
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", model,sessionStatus);
assertEquals("ViewName match", "redirect:/app/admin/categories?action=delete", view);
assertTrue("empty model", model.asMap().isEmpty());
verify(userService, categoryService, sessionStatus);
}