Merge branch 'develop' into trialMerge
[jalview.git] / test / jalview / analysis / DnaAlignmentGenerator.java
index 1b8964f..60dd929 100644 (file)
@@ -1,14 +1,37 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
 package jalview.analysis;
 
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceI;
+import jalview.gui.JvOptionPane;
 import jalview.io.FastaFile;
 
 import java.util.Arrays;
 import java.util.Random;
 
+import org.testng.annotations.BeforeClass;
+
 /**
  * Generates, and outputs in Fasta format, a random DNA alignment for given
  * sequence length and count. Will regenerate the same alignment each time if
@@ -30,15 +53,23 @@ import java.util.Random;
  */
 public class DnaAlignmentGenerator
 {
+
+  @BeforeClass(alwaysRun = true)
+  public void setUpJvOptionPane()
+  {
+    JvOptionPane.setInteractiveMode(false);
+    JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+  }
+
   private static final char GAP = '-';
 
   private static final char ZERO = '0';
 
-  private static final char[] BASES = new char[]
-  { 'G', 'T', 'C', 'A' };
+  private static final char[] BASES = new char[] { 'G', 'T', 'C', 'A' };
 
   private Random random;
-  
+
+
   /**
    * Outputs a DNA 'alignment' where each position is a random choice from
    * 'GTCA-'.
@@ -64,7 +95,7 @@ public class DnaAlignmentGenerator
             + " bases with " + gapPercentage + "% gaps and "
             + changePercentage + "% mutations (random seed = " + randomSeed
             + ")");
-    System.out.println(new FastaFile().print(al.getSequencesArray()));
+    System.out.println(new FastaFile().print(al.getSequencesArray(), true));
   }
 
   /**