verify(userService);
}
@Test
public void updateCategory_valid(){
Model model = new ExtendedModelMap();
User user = new UserImpl();
String id = "1";
String categoryText = "Social";
CategoryImpl category = new CategoryImpl(id);
category.setCreatedUserId(user.getId());
category.setText(categoryText);
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, validToken,REFERRER_ID, model, sessionStatus);
assertEquals("ViewName match", "redirect:/app/admin/categories?action=update&referringPageId=" + REFERRER_ID, view);
assertTrue("empty model", model.asMap().isEmpty());
verify(userService, categoryService, sessionStatus);
}