Esempio n. 1
0
  /** Tests the finding of first feed who's XML URL matches the given. */
  public void testFindFirstFeedByXmlURLNoMatch() throws MalformedURLException {
    DirectFeed feed0 = new DirectFeed();
    feed0.setBaseTitle("0");
    feed0.setXmlURL(new URL("file://0"));

    StandardGuide guide1 = new StandardGuide();
    guide1.add(feed0);

    set.add(guide1);

    NetworkFeed feed = set.findDirectFeed(new URL("file://test"));
    assertNull("Feed should not be found.", feed);
  }
Esempio n. 2
0
  /** Tests the finding of first feed who's XML URL matches the given. */
  public void testFindFirstFeedByXmlURLSingleGuide() throws MalformedURLException {
    DirectFeed feed0 = new DirectFeed();
    feed0.setBaseTitle("0");
    feed0.setXmlURL(new URL("file://0"));
    DirectFeed feed1 = new DirectFeed();
    feed1.setBaseTitle("1");
    feed1.setXmlURL(new URL("file://test"));
    DirectFeed feed2 = new DirectFeed();
    feed2.setBaseTitle("2");
    feed2.setXmlURL(new URL("file://test"));

    StandardGuide guide1 = new StandardGuide();
    guide1.add(feed0);
    guide1.add(feed1);
    guide1.add(feed2);

    set.add(guide1);

    NetworkFeed feed = set.findDirectFeed(new URL("file://test"));
    assertTrue("Wrong feed found: " + feed, feed == feed1);
  }
Esempio n. 3
0
  public void testGetFeedsXmlURLs() throws MalformedURLException {
    assertEquals("Please remove all guides from set by this point.", 0, set.getGuidesCount());

    StandardGuide guide1 = new StandardGuide();
    guide1.setTitle("1");
    StandardGuide guide2 = new StandardGuide();
    guide2.setTitle("2");

    DirectFeed feed1 = new DirectFeed();
    feed1.setXmlURL(new URL("file://1"));
    DirectFeed feed2 = new DirectFeed();
    feed2.setXmlURL(new URL("file://2"));
    DirectFeed feed3 = new DirectFeed();
    feed3.setXmlURL(new URL("file://3"));
    DirectFeed feed4 = new DirectFeed();
    feed4.setXmlURL(new URL("file://1"));
    SearchFeed feed5 = new SearchFeed();
    feed5.setBaseTitle("5");

    guide1.add(feed1);
    guide1.add(feed5);
    guide2.add(feed2);
    guide2.add(feed3);
    guide2.add(feed4);

    set.add(guide1);
    set.add(guide2);

    Collection urls = set.getFeedsXmlURLs();
    assertEquals("URL's of network feeds (de-duplicated) should be returned.", 3, urls.size());
    assertTrue(urls.contains(feed1.getXmlURL()));
    assertTrue(urls.contains(feed2.getXmlURL()));
    assertTrue(urls.contains(feed3.getXmlURL()));
  }