### Question:
RssViewer extends AbstractRssFeedView { @Override protected List<Item> buildFeedItems(Map<String, Object> newsComponents, HttpServletRequest request, HttpServletResponse response) throws IOException { String url = buildURL(request); List<Topic> listContent = (List<Topic>) newsComponents.get("topics"); if (listContent == null) { response.sendRedirect(request.getContextPath() + "/errors/404"); return null; } List<Item> items = new ArrayList<>(listContent.size()); for (Topic topic : listContent) { items.add(createFeedItem(topic, url)); } response.setContentType(getContentType()); return items; }    }### Answer:
@Test public void testBuildFeedItems() throws Exception { List<Item> items = rssViewer.buildFeedItems(newsComponents, request, response); assertEquals(items.get(0).getAuthor(), "username"); assertEquals(response.getContentType(), rssViewer.getContentType()); }
@Test public void testFeedBodyMustStripInvalidXMLSymbols() throws Exception { newsComponents.put("topics", getTopicsWithXMLSpecChars()); List<Item> items = rssViewer.buildFeedItems(newsComponents, request, response); assertTrue(containtsOnlyValidXMLChars(items.get(0).getDescription().getValue())); }
@Test public void testRedirect() throws IOException { newsComponents.put("topics", null); assertEquals(rssViewer.buildFeedItems(newsComponents, request, response), null); }