コード例 #1
0
 @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());
 }
コード例 #2
0
  @Before
  public void init()
      throws IOException, ParserConfigurationException, InvalidRssFeedException,
          InvalidDateFormatException, SAXException, ParseException {
    rssFeedService = new RssFeedServiceImpl();
    rssFeedService.setParser(parser);
    expectedFeed = getExpectedFeed();

    when(parser.parse()).thenReturn(expectedFeed);
  }
コード例 #3
0
 @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);
 }
コード例 #4
0
  @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);
  }
コード例 #5
0
 @Test(expected = NotFoundException.class)
 public void testGetPodcastByIdNotFound()
     throws NotFoundException, InvalidRssFeedException, SAXException, InvalidDateFormatException,
         ParserConfigurationException, IOException {
   rssFeedService.getRssFeedPodcastById("10", false);
 }