}
@Test
public void viewCategoryResult_valid() {
Model model = new ExtendedModelMap();
String categoryId = "1";
int offset = 0;
int pageSize = 10;
SearchResult<Widget> searchResults = new SearchResult<Widget>(new ArrayList<Widget>(),0);
expect(widgetService.getAllWidgetStatistics(validUser.getId())).andReturn(allWidgetStatisticsMap);
expect(tagService.getAllTags()).andReturn(new ArrayList<Tag>());
expect(categoryService.getAll()).andReturn(new ArrayList<Category>());
expect(widgetService.getWidgetsByCategory(categoryId, offset, pageSize)).andReturn(searchResults);
replay(widgetService, tagService, categoryService);
String view = controller.viewCategoryResult(REFERRER_ID, categoryId, offset, model);
verify(widgetService, tagService, categoryService);
assertThat(view, is(equalTo(ViewNames.STORE)));
assertThat(model.containsAttribute(ModelKeys.WIDGETS), is(true));
assertThat(model.containsAttribute(ModelKeys.WIDGETS_STATISTICS), is(true));
assertThat(model.containsAttribute(ModelKeys.TAGS), is(true));
assertThat(model.containsAttribute(ModelKeys.CATEGORIES), is(true));
assertThat(model.containsAttribute(ModelKeys.REFERRING_PAGE_ID), is(true));
assertThat(model.containsAttribute(ModelKeys.OFFSET), is(true));
assertThat(model.containsAttribute(ModelKeys.SELECTED_CATEGORY), is(true));
}