Merge branch 'features/JAL-2326_JOptionPane-refactoring' into develop
[jalview.git] / test / jalview / io / FileIOTester.java
index 0d66b21..26ece71 100644 (file)
@@ -20,6 +20,8 @@
  */
 package jalview.io;
 
+import jalview.gui.JvOptionPane;
+
 import java.io.File;
 import java.io.IOException;
 
@@ -35,10 +37,17 @@ import org.testng.annotations.Test;
 public class FileIOTester
 {
 
+  @BeforeClass(alwaysRun = true)
+  public void setUpJvOptionPane()
+  {
+    JvOptionPane.setInteractiveMode(false);
+    JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+  }
+
   /**
    * @throws java.lang.Exception
    */
-  @BeforeClass
+  @BeforeClass(alwaysRun = true)
   public static void setUpBeforeClass() throws Exception
   {
   }
@@ -46,7 +55,7 @@ public class FileIOTester
   /**
    * @throws java.lang.Exception
    */
-  @AfterClass
+  @AfterClass(alwaysRun = true)
   public static void tearDownAfterClass() throws Exception
   {
   }
@@ -67,13 +76,14 @@ public class FileIOTester
 
   private void assertValidFormat(String fmt, String src, FileParse fp)
   {
-    AssertJUnit.assertTrue("Couldn't resolve " + src + " as a valid file", fp.isValid());
-    String type = new IdentifyFile().Identify(fp);
+    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));
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testStarsInFasta1() throws IOException
   {
     String uri;
@@ -82,7 +92,7 @@ public class FileIOTester
     assertValidFormat("FASTA", uri, fp);
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testStarsInFasta2() throws IOException
   {
     String uri;
@@ -91,7 +101,7 @@ public class FileIOTester
     assertValidFormat("FASTA", uri, fp);
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testGzipIo() throws IOException
   {
     String uri;
@@ -100,7 +110,7 @@ public class FileIOTester
     assertValidFormat("FASTA", uri, fp);
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testGziplocalFileIO() throws IOException
   {
     String filepath;
@@ -109,7 +119,7 @@ public class FileIOTester
     assertValidFormat("FASTA", filepath, fp);
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testNonGzipURLIO() throws IOException
   {
     String uri;
@@ -118,7 +128,7 @@ public class FileIOTester
     assertValidFormat("FASTA", uri, fp);
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testNonGziplocalFileIO() throws IOException
   {
     String filepath;