JAL-1270 test suits import order refactor
[jalview.git] / test / jalview / io / StockholmFileTest.java
index cf61e6e..1c46d1f 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
@@ -35,7 +36,7 @@ import java.util.BitSet;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.junit.Test;
+import org.testng.annotations.Test;
 
 public class StockholmFileTest
 {
@@ -84,6 +85,7 @@ public class StockholmFileTest
    *          - label for IO class used to write and read back in the data from
    *          f
    */
+
   public static void testFileIOwithFormat(File f, String ioformat,
           int naliannot, int nminseqann)
   {
@@ -119,7 +121,7 @@ public class StockholmFileTest
               "Identify routine could not recognise output generated by '"
                       + ioformat + "' writer",
               ioformat.equals(identifyoutput));
-      testAlignmentEquivalence(al, al_input);
+      testAlignmentEquivalence(al, al_input, false);
       int numaliannot = 0, numsqswithali = 0;
       for (AlignmentAnnotation ala : al_input.getAlignmentAnnotation())
       {
@@ -157,9 +159,11 @@ public class StockholmFileTest
    * @param al_input
    *          'secondary' or generated alignment from some datapreserving
    *          transformation
+   * @param ignoreFeatures
+   *          when true, differences in seuqence feature annotation are ignored.
    */
   public static void testAlignmentEquivalence(AlignmentI al,
-          AlignmentI al_input)
+          AlignmentI al_input, boolean ignoreFeatures)
   {
     assertNotNull("Original alignment was null", al);
     assertNotNull("Generated alignment was null", al_input);
@@ -261,8 +265,10 @@ public class StockholmFileTest
                   + " are not equal", ss_original.equals(ss_new));
 
           assertTrue(
-                  "Sequence Features were not equivalent",
-                  (seq_original[i].getSequenceFeatures() == null && seq_new[in]
+                  "Sequence Features were not equivalent"
+                          + (ignoreFeatures ? " ignoring." : ""),
+                  ignoreFeatures
+                          || (seq_original[i].getSequenceFeatures() == null && seq_new[in]
                           .getSequenceFeatures() == null)
                           || (seq_original[i].getSequenceFeatures() != null && seq_new[in]
                                   .getSequenceFeatures() != null));