<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.rometools.certiorem.hub;

import java.io.IOException;
import java.net.URL;
import java.util.List;

import junit.framework.Assert;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.rometools.fetcher.impl.HashMapFeedInfoCache;
import org.rometools.fetcher.impl.HttpURLFeedFetcher;

import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;

/**
 * 
 * @author najmi
 */
public class DeltaSyndFeedInfoTest {

    DeltaFeedInfoCache feedInfoCache;
    HttpURLFeedFetcher feedFetcher;
    SyndFeed feed;

    public DeltaSyndFeedInfoTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
        feedInfoCache = new DeltaFeedInfoCache(new HashMapFeedInfoCache());
        feedFetcher = new HttpURLFeedFetcher(feedInfoCache);
    }

    @After
    public void tearDown() {
    }

    /**
     * Test of getSyndFeed method, of class DeltaSyndFeedInfo.
     */
    @Test
    public void testGetSyndFeed() throws Exception {
        System.out.println("getSyndFeed");

        feed = feedFetcher.retrieveFeed(getFeedUrl());
        List<SyndEntry> entries = feed.getEntries();
        Assert.assertTrue(!entries.isEmpty());

        // Fetch again and this time the entries should be empty as none have changed.
        feed = feedFetcher.retrieveFeed(getFeedUrl());
        entries = feed.getEntries();
        Assert.assertTrue(entries.isEmpty());
    }

    private URL getFeedUrl() throws IOException {
        final URL feedUrl = new URL("http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&output=rss");
        // URL feedUrl = new URL("http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml");

        return feedUrl;
    }
}<commit_msg>Removed warnings Cleanup up test<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.rometools.certiorem.hub;

import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.net.URL;
import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.rometools.fetcher.impl.HashMapFeedInfoCache;
import org.rometools.fetcher.impl.HttpURLFeedFetcher;

import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;

/**
 * 
 * @author najmi
 */
public class DeltaSyndFeedInfoTest {

    private DeltaFeedInfoCache feedInfoCache;
    private HttpURLFeedFetcher feedFetcher;
    private SyndFeed feed;

    @Before
    public void setUp() {
        feedInfoCache = new DeltaFeedInfoCache(new HashMapFeedInfoCache());
        feedFetcher = new HttpURLFeedFetcher(feedInfoCache);
    }

    /**
     * Test of getSyndFeed method, of class DeltaSyndFeedInfo.
     */
    @Test
    public void testGetSyndFeed() throws Exception {

        feed = feedFetcher.retrieveFeed(getFeedUrl());
        List<SyndEntry> entries = feed.getEntries();
        assertTrue(!entries.isEmpty());

        // Fetch again and this time the entries should be empty as none have changed.
        feed = feedFetcher.retrieveFeed(getFeedUrl());
        entries = feed.getEntries();
        assertTrue(entries.isEmpty());
    }

    private URL getFeedUrl() throws IOException {
        final URL feedUrl = new URL("http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&output=rss");
        // URL feedUrl = new URL("http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml");
        return feedUrl;
    }

}
{'fraction_non_alphanumeric': 0.10714285714285714, 'fraction_numerical': 0.0005252100840336134, 'mean_word_length': 3.3631156930126003, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1116645', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1175, 'n_words': 261}