### Question:
DefaultWidgetMarketplaceService implements WidgetMarketplaceService { @SuppressWarnings("unchecked") @Override public List<String> getCategories() throws Exception{ if (getStoreUrl() == null) throw new Exception("External marketplace URL not configured"); String url = getStoreUrl() + CATEGORY_LIST; ArrayList<String> categories = new ArrayList<String>(); @SuppressWarnings("rawtypes") List result = getRestJsonTemplate().getForObject(url, List.class); for (Object category:result){ categories.add((String)((Map<String, String>)category).get("tagtext")); } return categories; } @Autowired  DefaultWidgetMarketplaceService(RemoteWidgetResolverService widgetResolverService, PortalPreferenceService pps); @Override SearchResult<Widget> getWidgetsByFreeTextSearch(String searchTerm,
            int offset, int pageSize); @Override SearchResult<Widget> getWidgetsByCategory(String category, int offset,
            int pageSize); @SuppressWarnings("unchecked") @Override List<String> getCategories(); @Override Widget getWidget(String id); @Override Widget addWidget(Widget widget); @Override Widget resolveWidgetMetadata(String url, String type);  }### Answer:
@Ignore @Test public void getCategories() throws Exception{ prefs = createMock(PortalPreferenceService.class); service = new DefaultWidgetMarketplaceService(widgetResolverService, prefs); List<String> results = service.getCategories(); for (String category: results){ System.out.println(category); } }