1   /*
2    * Created on Feb 8, 2005
3    *
4    * TODO To change the template for this generated file go to
5    * Window - Preferences - Java - Code Style - Code Templates
6    */
7   package net.sf.gumshoe.indexer;
8   
9   import java.io.BufferedReader;
10  import java.io.File;
11  import java.io.Reader;
12  
13  import org.apache.lucene.document.Document;
14  
15  import junit.framework.TestCase;
16  
17  /***
18   * @author Gabor
19   *
20   * TODO To change the template for this generated type comment go to
21   * Window - Preferences - Java - Code Style - Code Templates
22   */
23  public class XMLContentReaderTest extends TestCase {
24  
25  	public static void main(String[] args) {
26  		junit.textui.TestRunner.run(XMLContentReaderTest.class);
27  	}
28  
29  	public void testGetDocument() throws Exception {
30  		XMLContentReader x=new XMLContentReader();
31  		Document d=x.getDocument(new File("src/test/testdata/htmlA.html"));
32  		Reader r=d.getField(ContentReader.CONTENTS).readerValue();
33          BufferedReader br = new BufferedReader(r);
34          String line = null;
35          StringBuffer sb = new StringBuffer();
36          while ( (line=br.readLine()) != null )
37          {
38              sb.append(line);
39          }
40  		assertTrue("found correct content", sb.indexOf("htmlA")>-1);
41  	}
42  }