Coverage Report - org.apache.commons.feedparser.test.TestFeedParserUTF8
 
Classes in this File Line Coverage Branch Coverage Complexity
TestFeedParserUTF8
0%
0/25
0%
0/4
1.5
 
 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.io.FileInputStream;
 20  
 
 21  
 import javax.xml.parsers.DocumentBuilder;
 22  
 import javax.xml.parsers.DocumentBuilderFactory;
 23  
 
 24  
 import junit.framework.TestCase;
 25  
 
 26  
 import org.apache.commons.feedparser.FeedParser;
 27  
 import org.apache.commons.feedparser.FeedParserFactory;
 28  
 import org.apache.commons.feedparser.FeedParserListener;
 29  
 import org.apache.commons.feedparser.impl.DebugFeedParserListener;
 30  
 
 31  
 /**
 32  
  *
 33  
  * @author <a href="mailto:burton@peerfear.org">Kevin A. Burton</a>
 34  
  * @version $Id: TestFeedParserUTF8.java 373622 2006-01-30 22:53:00Z mvdb $
 35  
  */
 36  
 public class TestFeedParserUTF8 extends TestCase {
 37  
 
 38  
     public TestFeedParserUTF8( String name ) throws Exception {
 39  0
         super( name );
 40  0
     }
 41  
 
 42  
     public void testAssertXerces() throws Exception {
 43  
 
 44  
         String v;
 45  
         
 46  0
         DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
 47  
 
 48  0
         v = db.getClass().getName();
 49  
         
 50  0
         if ( ! v.equals( "org.apache.xerces.jaxp.DocumentBuilderImpl" ) )
 51  0
             throw new Exception( "Incorrect version of Xerces: " + v );
 52  
 
 53  0
         v = org.apache.xerces.impl.Version.fVersion;
 54  
         
 55  0
         if ( v.indexOf( "2.6" ) == -1 )
 56  0
             throw new Exception( "Incorrect version of Xerces: " + v);
 57  
 
 58  0
     }
 59  
 
 60  
     public void test( String path ) throws Exception {
 61  
 
 62  0
         FeedParser parser = FeedParserFactory.newFeedParser();
 63  
 
 64  0
         FeedParserListener listener = new DebugFeedParserListener();
 65  
 
 66  0
         parser.parse( listener,
 67  
                       new FileInputStream( "src/java/org/apache/commons/feedparser/test/" + path),
 68  
                       path );
 69  
 
 70  0
     }
 71  
 
 72  
     public void test1() throws Exception {
 73  
 
 74  0
         test( "TestFeedParserUTF8.rss" );
 75  
 
 76  0
     }
 77  
         
 78  
     public void test2() throws Exception {
 79  
 
 80  0
         test( "broken-UTF8-feed.rss" );
 81  0
     }
 82  
 
 83  
     public void test3() throws Exception {
 84  
 
 85  0
         test( "broken-Invalid-byte-2-of-3-byte-UTF-8-sequence.xml" );
 86  0
     }
 87  
 
 88  
     public void test4() throws Exception {
 89  
 
 90  0
         test( "broken-salon.rdf" );
 91  0
     }
 92  
 
 93  
     public static void main( String[] args ) throws Exception {
 94  
 
 95  0
         TestFeedParserUTF8 test = new TestFeedParserUTF8( null );
 96  
 
 97  
         //test.testGetWeblogLinkForResource();
 98  
         //test.testParse();
 99  0
         test.test2();
 100  
         
 101  0
     }
 102  
 
 103  
 }
 104