Coverage Report - org.apache.commons.feedparser.test.TestFeedLocator
 
Classes in this File Line Coverage Branch Coverage Complexity
TestFeedLocator
0%
0/24
0%
0/2
1.25
 
 1  
 /*
 2  
  * Copyright 1999,2004 The Apache Software Foundation.
 3  
  * 
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  * 
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  * 
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package org.apache.commons.feedparser.test;
 18  
 
 19  
 import java.util.Iterator;
 20  
 
 21  
 import junit.framework.TestCase;
 22  
 
 23  
 import org.apache.commons.feedparser.FeedList;
 24  
 import org.apache.commons.feedparser.locate.FeedLocator;
 25  
 
 26  
 /**
 27  
  *
 28  
  * @author <a href="mailto:burton@peerfear.org">Kevin A. Burton</a>
 29  
  * @version $Id: TestFeedLocator.java 373622 2006-01-30 22:53:00Z mvdb $
 30  
  */
 31  
 public class TestFeedLocator extends TestCase {
 32  
     protected String feedparserHome;
 33  
     
 34  
     public TestFeedLocator( String name ) throws Exception {
 35  0
         super( name );
 36  
         
 37  0
         feedparserHome = System.getProperty("feedparser.home", ".");
 38  
         // these come in as forward slashes, even on Windows, because of Ant,
 39  
         // so it is safe to check them as / rather than File.separator
 40  
         // Brad Neuberg
 41  0
         if (feedparserHome.endsWith("/") == false)
 42  0
             feedparserHome = feedparserHome + "/";
 43  0
     }
 44  
 
 45  
     private void doTest( String resource ) throws Exception {
 46  
 
 47  0
         System.out.println( "resource: " + resource );
 48  
         
 49  0
         FeedList l = FeedLocator.locate( resource );
 50  
 
 51  0
         Iterator it = l.iterator();
 52  
 
 53  
         // See if no links were found
 54  0
         assertTrue("No links were found for " + resource, it.hasNext());
 55  0
         System.out.println( "Atom: " + l.getAdAtomFeed() );
 56  0
         System.out.println( "RSS: " + l.getAdRSSFeed() );
 57  
         
 58  0
     }
 59  
     
 60  
     public void test1() throws Exception {
 61  0
         String path = "file:" + feedparserHome;
 62  
 
 63  0
         doTest( path + "tests/locate/locate1.html" );
 64  0
         doTest( path + "tests/locate/locate2.html" );
 65  0
         doTest( path + "tests/locate/locate3.html" );
 66  0
         doTest( path + "tests/locate/locate4.html" );
 67  
         //doTest( path + "tests/locate/locate5.html" );
 68  0
         doTest( path + "tests/locate/locate6.html" );
 69  0
         doTest( path + "tests/locate/locate7.html" );
 70  0
         doTest( path + "tests/locate/locate10.html" );
 71  0
     }
 72  
 
 73  
     public static void main( String[] args ) throws Exception {
 74  
 
 75  0
         TestFeedLocator test = new TestFeedLocator( null );
 76  
         
 77  
         //test.testGetWeblogLinkForResource();
 78  0
         test.test1();
 79  
 
 80  0
     }
 81  
 
 82  
 }
 83