public static void tearDownAfterClass() throws Exception
{
}
-final static File ALIGN_FILE = new File("test/jalview/io/test_gz_fasta.gz");
+ final static File ALIGN_FILE = new File("test/jalview/io/test_gz_fasta.gz");
+ final static File NOTGZALIGN_FILE = new File("test/jalview/io/test_gz_fasta_notgz.gz");
+ private void assertValidFasta(String src, FileParse fp)
+ {
+ assertTrue("Couldn't resolve "+src+" as a valid file",fp.isValid());
+ String type = new IdentifyFile().Identify(fp);
+ assertTrue("Gzipped data from '"+src+"' identified as '"+type+"'",type.equalsIgnoreCase("FASTA"));
+ }
@Test
public void testGzipIo() throws IOException
{
String uri;
FileParse fp = new FileParse(uri=ALIGN_FILE.getAbsoluteFile().toURI().toString(),AppletFormatAdapter.URL);
- assertTrue("Couldn't resolve "+uri+" as a valid file",fp.isValid());
- String type = new IdentifyFile().Identify(fp);
- assertTrue("Gzipped data from '"+uri+"' identified as '"+type+"'",type.equalsIgnoreCase("FASTA"));
+ assertValidFasta(uri, fp);
}
@Test
{
String filepath;
FileParse fp = new FileParse(filepath=ALIGN_FILE.getAbsoluteFile().toString(), AppletFormatAdapter.FILE);
- assertTrue("Couldn't resolve " + filepath + " as a valid file", fp.isValid());
- String type = new IdentifyFile().Identify(fp);
- assertTrue("Gzipped data from '" + filepath + "' identified as '" + type
- + "'", type.equalsIgnoreCase("FASTA"));
+ assertValidFasta(filepath, fp);
+ }
+ @Test
+ public void testNonGzipURLIO() throws IOException
+ {
+ String uri;
+ FileParse fp = new FileParse(uri=NOTGZALIGN_FILE.getAbsoluteFile().toURI().toString(),AppletFormatAdapter.URL);
+ assertValidFasta(uri, fp);
+ }
+ @Test
+ public void testNonGziplocalFileIO() throws IOException
+ {
+ String filepath;
+ FileParse fp = new FileParse(filepath=NOTGZALIGN_FILE.getAbsoluteFile().toString(), AppletFormatAdapter.FILE);
+ assertValidFasta(filepath, fp);
}
}