1   package baseCode.xml;
2   
3   import java.io.IOException;
4   import java.io.InputStream;
5   
6   import junit.framework.TestCase;
7   import baseCode.util.RegressionTesting;
8   import baseCode.xml.GOParser;
9   
10  /***
11   * <p>
12   * Copyright (c) 2004
13   * </p>
14   * <p>
15   * Institution: Columbia University
16   * </p>
17   * 
18   * @author Paul Pavlidis
19   * @version $Id: TestGOParser.java,v 1.1 2005/03/17 13:58:42 pavlidis Exp $
20   */
21  
22  public class TestGOParser extends TestCase {
23     private GOParser gOParser = null;
24  
25     protected void setUp() throws Exception {
26        super.setUp();
27        InputStream i = GOParser.class
28              .getResourceAsStream( "/data/go-termdb-sample.xml" );
29        //  GOParser.class.getResourceAsStream( "/data/go_200406-termdb.xml" );
30        if ( i == null ) {
31           throw new Exception( "Couldn't read the sample file" );
32        }
33        gOParser = new GOParser( i );
34  
35     }
36  
37     protected void tearDown() throws Exception {
38        gOParser = null;
39        super.tearDown();
40     }
41  
42     public void testGOParser() throws IOException {
43        String actualReturn = gOParser.getGraph().toString();
44        String expectedReturn = RegressionTesting
45              .readTestResult( "/data/goparsertestoutput.txt" );
46        assertEquals( "return", expectedReturn, actualReturn );
47        /*
48         * assertEquals( "Diffs: " + RegressionTesting.regress( expectedReturn,
49         * actualReturn ), expectedReturn, actualReturn );
50         */
51     }
52  
53  }