JAL-1805 modified test setup's so the are ran for groups which requires them
[jalview.git] / test / jalview / analysis / AlignmentAnnotationUtilsTest.java
index 19a5163..b68842a 100644 (file)
@@ -1,10 +1,12 @@
 package jalview.analysis;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertTrue;
+
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
 import jalview.datamodel.SequenceI;
 import jalview.io.AppletFormatAdapter;
 
@@ -16,8 +18,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 public class AlignmentAnnotationUtilsTest
 {
@@ -43,7 +45,7 @@ public class AlignmentAnnotationUtilsTest
   /**
    * Test method that converts a (possibly null) array to a list.
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testAsList()
   {
     // null array
@@ -111,7 +113,12 @@ public class AlignmentAnnotationUtilsTest
     return result;
   }
 
-  @Before
+  /**
+   * Load the test alignment and generate annotations on it
+   * 
+   * @throws IOException
+   */
+ @BeforeMethod(alwaysRun = true)
   public void setUp() throws IOException
   {
     alignment = new jalview.io.FormatAdapter().readFile(TEST_DATA,
@@ -120,7 +127,13 @@ public class AlignmentAnnotationUtilsTest
     AlignmentAnnotation[] anns = new AlignmentAnnotation[SEQ_ANN_COUNT];
     for (int i = 0; i < anns.length; i++)
     {
-      anns[i] = new AlignmentAnnotation("Label" + i, null, 0d);
+      /*
+       * Use the constructor for a positional annotation (with an Annotation
+       * array)
+       */
+      anns[i] = new AlignmentAnnotation("Label" + i, "Desc " + i,
+              new Annotation[]
+              {});
       anns[i].setCalcId("CalcId" + i);
       anns[i].visible = true;
       alignment.addAnnotation(anns[i]);
@@ -130,7 +143,7 @@ public class AlignmentAnnotationUtilsTest
   /**
    * Test a mixture of show/hidden annotations in/outside selection group.
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testGetShownHiddenTypes_forSelectionGroup()
   {
     Map<String, List<List<String>>> shownTypes = new HashMap<String, List<List<String>>>();
@@ -209,7 +222,7 @@ public class AlignmentAnnotationUtilsTest
    * Test case where there are 'grouped' annotations, visible and hidden, within
    * and without the selection group.
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testGetShownHiddenTypes_withGraphGroups()
   {
     final int GROUP_3 = 3;
@@ -304,6 +317,11 @@ public class AlignmentAnnotationUtilsTest
     anns[9].graph = AlignmentAnnotation.LINE_GRAPH;
     anns[9].graphGroup = GROUP_4;
   
+    /*
+     * Generate annotations[] arrays to match aligned columns
+     */
+    // adjustForAlignment(anns);
+
     List<SequenceI> selected = selectSequences(0, 3);
     AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes,
             AlignmentAnnotationUtils.asList(anns),
@@ -330,7 +348,7 @@ public class AlignmentAnnotationUtilsTest
   /**
    * Test method that determines visible graph groups.
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testGetVisibleGraphGroups()
   {
     AlignmentAnnotation[] anns = alignment.getAlignmentAnnotation();
@@ -377,7 +395,7 @@ public class AlignmentAnnotationUtilsTest
    * Test for case where no sequence is selected. Shouldn't normally arise but
    * check it handles it gracefully.
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testGetShownHiddenTypes_noSequenceSelected()
   {
     Map<String, List<List<String>>> shownTypes = new HashMap<String, List<List<String>>>();