### Question:
RssViewer extends AbstractRssFeedView { @Override protected void buildFeedMetadata(Map<String, Object> newsComponents, Channel feed, HttpServletRequest request) { Component component = (Component)newsComponents.get("forumComponent"); String feedTitle = DEFAULT_FEED_TITLE; String feedDescription = DEFAULT_FEED_DESCRIPTION; if (component != null) { feedTitle = component.getName(); feedDescription = component.getDescription(); } feed.setTitle(feedTitle); feed.setDescription(feedDescription); feed.setLink(buildURL(request)); super.buildFeedMetadata(newsComponents, feed, request); }    }### Answer:
@Test public void rssShouldBeGeneratedWithMetaDataFromComponent() throws Exception { Component component = new Component(); String name = "my component"; String description = "my description"; component.setName(name); component.setDescription(description); newsComponents.put("forumComponent", component); rssViewer.buildFeedMetadata(newsComponents, channel, request); assertFalse(channel.equals(new Channel())); assertEquals(channel.getTitle(), name); assertEquals(channel.getDescription(), description); }
@Test public void rssShouldBeGeneratedWithEmptyFeedMetaDataWhenThereIsNoComponent() { rssViewer.buildFeedMetadata(newsComponents, channel, request); assertTrue(channel.getTitle().isEmpty()); assertTrue(channel.getDescription().isEmpty()); }