Merge branch 'develop' into bug/JAL-2255_seq-fetcher-broken-on-linux
[jalview.git] / test / jalview / analysis / DnaTest.java
index 1851517..2e21d9c 100644 (file)
@@ -32,14 +32,25 @@ import jalview.datamodel.ColumnSelection;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceI;
 import jalview.gui.AlignViewport;
+import jalview.gui.JvOptionPane;
+import jalview.io.DataSourceType;
+import jalview.io.FileFormat;
 import jalview.io.FormatAdapter;
 
 import java.io.IOException;
 
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
 public class DnaTest
 {
+  @BeforeClass(alwaysRun = true)
+  public void setUpJvOptionPane()
+  {
+    JvOptionPane.setInteractiveMode(false);
+    JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+  }
+
   // @formatter:off
   // AA encoding codons as ordered on the Jalview help page Amino Acid Table
   private static String fasta = ">B\n" + "GCT" + "GCC" + "GCA" + "GCG"
@@ -120,8 +131,8 @@ public class DnaTest
           throws IOException
   {
     AlignmentI alf = new FormatAdapter().readFile(
-            JAL_1312_example_align_fasta, jalview.io.FormatAdapter.PASTE,
-            "FASTA");
+            JAL_1312_example_align_fasta, DataSourceType.PASTE,
+            FileFormat.Fasta);
     ColumnSelection cs = new ColumnSelection();
     AlignViewportI av = new AlignViewport(alf, cs);
     Dna dna = new Dna(av, new int[] { 0, alf.getWidth() - 1 });
@@ -141,8 +152,8 @@ public class DnaTest
           throws IOException
   {
     AlignmentI alf = new FormatAdapter().readFile(
-            JAL_1312_example_align_fasta, jalview.io.FormatAdapter.PASTE,
-            "FASTA");
+            JAL_1312_example_align_fasta, DataSourceType.PASTE,
+            FileFormat.Fasta);
     int vwidth = 15;
     for (int ipos = 0; ipos + vwidth < alf.getWidth(); ipos += vwidth)
     {
@@ -176,7 +187,7 @@ public class DnaTest
   public void testTranslateCdna_simple() throws IOException
   {
     AlignmentI alf = new FormatAdapter().readFile(fasta,
-            FormatAdapter.PASTE, "FASTA");
+            DataSourceType.PASTE, FileFormat.Fasta);
     ColumnSelection cs = new ColumnSelection();
     AlignViewportI av = new AlignViewport(alf, cs);
     Dna dna = new Dna(av, new int[] { 0, alf.getWidth() - 1 });
@@ -196,8 +207,8 @@ public class DnaTest
   public void testTranslateCdna_hiddenColumns() throws IOException
   {
     AlignmentI alf = new FormatAdapter().readFile(fasta,
-            FormatAdapter.PASTE, "FASTA");
-    ColumnSelection cs = new jalview.datamodel.ColumnSelection();
+            DataSourceType.PASTE, FileFormat.Fasta);
+    ColumnSelection cs = new ColumnSelection();
     cs.hideColumns(6, 14); // hide codons 3/4/5
     cs.hideColumns(24, 35); // hide codons 9-12
     cs.hideColumns(177, 191); // hide codons 60-64
@@ -283,7 +294,8 @@ public class DnaTest
     /*
      * Generate cDNA - 8 sequences of 12 bases each.
      */
-    AlignmentI cdna = new DnaAlignmentGenerator().generate(12, 8, 97, 5, 5);
+    AlignmentI cdna = new AlignmentGenerator(true)
+            .generate(12, 8, 97, 5, 5);
     ColumnSelection cs = new ColumnSelection();
     AlignViewportI av = new AlignViewport(cdna, cs);
     Dna dna = new Dna(av, new int[] { 0, cdna.getWidth() - 1 });