JAL-1286 URL stream reader tries to use a GZIPInputStream if URL ends in .gz
[jalview.git] / test / jalview / io / FileIOTester.java
1 /**
2  * 
3  */
4 package jalview.io;
5
6 import static org.junit.Assert.*;
7
8 import java.io.File;
9 import java.io.IOException;
10
11 import org.junit.AfterClass;
12 import org.junit.BeforeClass;
13 import org.junit.Test;
14
15 /**
16  * @author jimp
17  *
18  */
19 public class FileIOTester
20 {
21
22   /**
23    * @throws java.lang.Exception
24    */
25   @BeforeClass
26   public static void setUpBeforeClass() throws Exception
27   {
28   }
29
30   /**
31    * @throws java.lang.Exception
32    */
33   @AfterClass
34   public static void tearDownAfterClass() throws Exception
35   {
36   }
37 final static File ALIGN_FILE = new File("test/jalview/io/test_gz_fasta.gz");
38
39   @Test
40   public void testGzipIo() throws IOException
41   {     
42     String uri;
43     FileParse fp = new FileParse(uri=ALIGN_FILE.getAbsoluteFile().toURI().toString(),AppletFormatAdapter.URL);
44     assertTrue("Couldn't resolve "+uri+" as a valid file",fp.isValid());
45     String type = new IdentifyFile().Identify(fp);
46     assertTrue("Gzipped data from '"+uri+"' identified as '"+type+"'",type.equalsIgnoreCase("FASTA"));
47   }
48
49 }