assertThat((String) model.asMap().get(ModelKeys.REFERRING_PAGE_ID), is(equalTo(REFERRER_ID)));
}
@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);
}