    1   package baseCode.io.reader;
    2
    3   import java.io.IOException;
    4   import java.io.InputStream;
    5
    6   import junit.framework.TestCase;
    7   import baseCode.io.reader.MapReader;
    8
    9   /***
    10   * <p>
    11   * Title:
    12   * </p>
    13   * <p>
    14   * Description:
    15   * </p>
    16   * <p>
    17   * Copyright (c) 2004
    18   * </p>
    19   * <p>
    20   * Institution: Columbia University
    21   * </p>
    22   *
    23   * @author Paul Pavlidis
    24   * @version $Id: TestMapReader.java,v 1.1 2005/03/17 13:58:42 pavlidis Exp $
    25   */
    26
    27  public class TestMapReader extends TestCase {
    28     private MapReader mapReader = null;
    29
    30     protected void setUp() throws Exception {
    31        super.setUp();
    32        mapReader = new MapReader();
    33     }
    34
    35     protected void tearDown() throws Exception {
    36        mapReader = null;
    37        super.tearDown();
    38     }
    39
    40     public void testRead() throws IOException {
    41        InputStream m = TestMapReader.class
    42              .getResourceAsStream( "/data/testmap.txt" );
    43        int expectedReturn = 100;
    44        int actualReturn = mapReader.read( m, true ).size(); // file has header
    45        assertEquals( "return value", expectedReturn, actualReturn );
    46     }
    47
    48     public void testReadNoHeader() throws IOException {
    49        InputStream m = TestMapReader.class
    50              .getResourceAsStream( "/data/testmap.txt" );
    51        int expectedReturn = 101;
    52        int actualReturn = mapReader.read( m ).size(); // file has header
    53        assertEquals( "return value", expectedReturn, actualReturn );
    54     }
    55
    56  }