@Test
 public void testGetPodcastById()
     throws IOException, ParserConfigurationException, InvalidRssFeedException,
         InvalidDateFormatException, SAXException, NotFoundException {
   Feed actualFeed = rssFeedService.getRssFeedPodcastById("3", false);
   assertNotNull("Feed Object should not be null ", actualFeed);
   assertEquals(1, actualFeed.getPodcasts().size());
   assertEquals("3", actualFeed.getPodcasts().get(0).getId());
 }
  @Before
  public void init()
      throws IOException, ParserConfigurationException, InvalidRssFeedException,
          InvalidDateFormatException, SAXException, ParseException {
    rssFeedService = new RssFeedServiceImpl();
    rssFeedService.setParser(parser);
    expectedFeed = getExpectedFeed();

    when(parser.parse()).thenReturn(expectedFeed);
  }
 @Test
 public void testGetMostRecentPodcast()
     throws IOException, ParserConfigurationException, InvalidRssFeedException,
         InvalidDateFormatException, SAXException, NotFoundException {
   Feed actualFeed = rssFeedService.getRssFeedPodcasts(true);
   assertNotNull("Feed Object should not be null ", actualFeed);
   assertEquals(1, actualFeed.getPodcasts().size());
   String actualMostRecentDate =
       DateUtils.convertDateToGMTString(actualFeed.getPodcasts().get(0).getPubDate());
   assertEquals(ACTUAL_MOST_RECENT_DATE, actualMostRecentDate);
 }
  @Test
  public void testGetPodcastAlternateTrue()
      throws NotFoundException, InvalidRssFeedException, SAXException, InvalidDateFormatException,
          ParserConfigurationException, IOException {
    Feed actualFeed = rssFeedService.getRssFeedPodcastById("3", true);

    assertNotNull("Feed Object should not be null ", actualFeed);
    assertEquals(4, actualFeed.getPodcasts().size());
    boolean isPresent = false;
    for (int i = 0; i < actualFeed.getPodcasts().size(); i++) {
      if (actualFeed.getPodcasts().get(i).getId().equals("3")) isPresent = true;
    }
    assertFalse("podcast with id=3 should not be included in the result", isPresent);
  }
 @Test(expected = NotFoundException.class)
 public void testGetPodcastByIdNotFound()
     throws NotFoundException, InvalidRssFeedException, SAXException, InvalidDateFormatException,
         ParserConfigurationException, IOException {
   rssFeedService.getRssFeedPodcastById("10", false);
 }