/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
- * Copyright (C) 2015 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
*/
package jalview.io;
+import jalview.gui.JvOptionPane;
+
import java.io.File;
import java.io.IOException;
public class FileIOTester
{
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
+
/**
* @throws java.lang.Exception
*/
/**
* @throws java.lang.Exception
*/
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
}
final static File STARS_FA_FILE2 = new File(
"test/jalview/io/test_fasta_stars2.fa");
- private void assertValidFormat(String fmt, String src, FileParse fp)
+ private void assertValidFormat(FileFormatI fmt, String src, FileParse fp)
+ throws FileFormatException
{
AssertJUnit.assertTrue("Couldn't resolve " + src + " as a valid file",
fp.isValid());
- String type = new IdentifyFile().Identify(fp);
- AssertJUnit.assertTrue("Data from '" + src + "' Expected to be '" + fmt
- + "' identified as '" + type + "'", type.equalsIgnoreCase(fmt));
+ FileFormatI type = new IdentifyFile().identify(fp);
+ AssertJUnit.assertSame("Data from '" + src + "' Expected to be '" + fmt
+ + "' identified as '" + type + "'", type, fmt);
}
@Test(groups = { "Functional" })
{
String uri;
FileParse fp = new FileParse(uri = STARS_FA_FILE1.getAbsoluteFile()
- .toString(), AppletFormatAdapter.FILE);
- assertValidFormat("FASTA", uri, fp);
+ .toString(), DataSourceType.FILE);
+ assertValidFormat(FileFormat.Fasta, uri, fp);
}
@Test(groups = { "Functional" })
{
String uri;
FileParse fp = new FileParse(uri = STARS_FA_FILE2.getAbsoluteFile()
- .toString(), AppletFormatAdapter.FILE);
- assertValidFormat("FASTA", uri, fp);
+ .toString(), DataSourceType.FILE);
+ assertValidFormat(FileFormat.Fasta, uri, fp);
}
@Test(groups = { "Functional" })
{
String uri;
FileParse fp = new FileParse(uri = ALIGN_FILE.getAbsoluteFile().toURI()
- .toString(), AppletFormatAdapter.URL);
- assertValidFormat("FASTA", uri, fp);
+ .toString(), DataSourceType.URL);
+ assertValidFormat(FileFormat.Fasta, uri, fp);
}
@Test(groups = { "Functional" })
{
String filepath;
FileParse fp = new FileParse(filepath = ALIGN_FILE.getAbsoluteFile()
- .toString(), AppletFormatAdapter.FILE);
- assertValidFormat("FASTA", filepath, fp);
+ .toString(), DataSourceType.FILE);
+ assertValidFormat(FileFormat.Fasta, filepath, fp);
}
@Test(groups = { "Functional" })
{
String uri;
FileParse fp = new FileParse(uri = NOTGZALIGN_FILE.getAbsoluteFile()
- .toURI().toString(), AppletFormatAdapter.URL);
- assertValidFormat("FASTA", uri, fp);
+ .toURI().toString(), DataSourceType.URL);
+ assertValidFormat(FileFormat.Fasta, uri, fp);
}
@Test(groups = { "Functional" })
{
String filepath;
FileParse fp = new FileParse(filepath = NOTGZALIGN_FILE
- .getAbsoluteFile().toString(), AppletFormatAdapter.FILE);
- assertValidFormat("FASTA", filepath, fp);
+ .getAbsoluteFile().toString(), DataSourceType.FILE);
+ assertValidFormat(FileFormat.Fasta, filepath, fp);
}
}