JAL-1759 merge from develop
[jalview.git] / test / jalview / analysis / AnnotationSorterTest.java
index 8c3489b..37bfca4 100644 (file)
@@ -84,7 +84,7 @@ public class AnnotationSorterTest
    * sequence ref</li>
    * </ul>
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testSortBySequenceAndType_autocalcLast()
   {
     // @formatter:off
@@ -111,7 +111,7 @@ public class AnnotationSorterTest
   /**
    * Variant with autocalculated annotations sorting to front
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testSortBySequenceAndType_autocalcFirst()
   {
     // @formatter:off
@@ -147,7 +147,7 @@ public class AnnotationSorterTest
    * sequence ref</li>
    * </ul>
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testSortByTypeAndSequence_autocalcLast()
   {
     // @formatter:off
@@ -174,7 +174,7 @@ public class AnnotationSorterTest
   /**
    * Variant of test with autocalculated annotations sorted to front
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testSortByTypeAndSequence_autocalcFirst()
   {
     // @formatter:off
@@ -202,7 +202,7 @@ public class AnnotationSorterTest
    * Variant of test with autocalculated annotations sorted to front but
    * otherwise no change.
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testNoSort_autocalcFirst()
   {
     // @formatter:off
@@ -226,7 +226,7 @@ public class AnnotationSorterTest
     assertEquals("Structure", anns[6].label);
   }
 
-  @Test
+  @Test(groups ={ "Functional" })
   public void testSort_timingPresorted()
   {
     testTiming_presorted(50, 100);
@@ -242,23 +242,23 @@ public class AnnotationSorterTest
    */
   private void testTiming_presorted(final int numSeqs, final int numAnns)
   {
-    al = buildAlignment(numSeqs);
-    anns = buildAnnotations(numAnns);
+    Alignment alignment = buildAlignment(numSeqs);
+    AlignmentAnnotation[] annotations = buildAnnotations(numAnns);
 
     /*
      * Set the annotations presorted by label
      */
     Random r = new Random();
-    final SequenceI[] sequences = al.getSequencesArray();
-    for (int i = 0; i < anns.length; i++)
+    final SequenceI[] sequences = alignment.getSequencesArray();
+    for (int i = 0; i < annotations.length; i++)
     {
       SequenceI randomSequenceRef = sequences[r.nextInt(sequences.length)];
-      anns[i].sequenceRef = randomSequenceRef;
-      anns[i].label = "label" + i;
+      annotations[i].sequenceRef = randomSequenceRef;
+      annotations[i].label = "label" + i;
     }
     long startTime = System.currentTimeMillis();
-    AnnotationSorter testee = new AnnotationSorter(al, false);
-    testee.sort(anns, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
+    AnnotationSorter testee = new AnnotationSorter(alignment, false);
+    testee.sort(annotations, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
     long endTime = System.currentTimeMillis();
     final long elapsed = endTime - startTime;
     System.out.println("Timing test for presorted " + numSeqs
@@ -269,7 +269,7 @@ public class AnnotationSorterTest
   /**
    * Timing tests for sorting randomly sorted annotations for various sizes.
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testSort_timingUnsorted()
   {
     testTiming_unsorted(50, 100);
@@ -286,23 +286,23 @@ public class AnnotationSorterTest
    */
   private void testTiming_unsorted(final int numSeqs, final int numAnns)
   {
-    al = buildAlignment(numSeqs);
-    anns = buildAnnotations(numAnns);
+    Alignment alignment = buildAlignment(numSeqs);
+    AlignmentAnnotation[] annotations = buildAnnotations(numAnns);
 
     /*
      * Set the annotations in random order with respect to the sequences
      */
     Random r = new Random();
-    final SequenceI[] sequences = al.getSequencesArray();
-    for (int i = 0; i < anns.length; i++)
+    final SequenceI[] sequences = alignment.getSequencesArray();
+    for (int i = 0; i < annotations.length; i++)
     {
       SequenceI randomSequenceRef = sequences[r.nextInt(sequences.length)];
-      anns[i].sequenceRef = randomSequenceRef;
-      anns[i].label = "label" + i;
+      annotations[i].sequenceRef = randomSequenceRef;
+      annotations[i].label = "label" + i;
     }
     long startTime = System.currentTimeMillis();
-    AnnotationSorter testee = new AnnotationSorter(al, false);
-    testee.sort(anns, SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
+    AnnotationSorter testee = new AnnotationSorter(alignment, false);
+    testee.sort(annotations, SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
     long endTime = System.currentTimeMillis();
     final long elapsed = endTime - startTime;
     System.out.println("Timing test for unsorted " + numSeqs
@@ -313,7 +313,7 @@ public class AnnotationSorterTest
   /**
    * Timing test for sorting annotations with a limited range of types (labels).
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testSort_timingSemisorted()
   {
     testTiming_semiSorted(50, 100);
@@ -336,8 +336,8 @@ public class AnnotationSorterTest
    */
   private void testTiming_semiSorted(final int numSeqs, final int numAnns)
   {
-    al = buildAlignment(numSeqs);
-    anns = buildAnnotations(numAnns);
+    Alignment alignment = buildAlignment(numSeqs);
+    AlignmentAnnotation[] annotations = buildAnnotations(numAnns);
 
     String[] labels = new String[]
     { "label1", "label2", "label3", "label4", "label5", "label6" };
@@ -346,16 +346,16 @@ public class AnnotationSorterTest
      * Set the annotations in sequence order with randomly assigned labels.
      */
     Random r = new Random();
-    final SequenceI[] sequences = al.getSequencesArray();
-    for (int i = 0; i < anns.length; i++)
+    final SequenceI[] sequences = alignment.getSequencesArray();
+    for (int i = 0; i < annotations.length; i++)
     {
       SequenceI sequenceRef = sequences[i % sequences.length];
-      anns[i].sequenceRef = sequenceRef;
-      anns[i].label = labels[r.nextInt(labels.length)];
+      annotations[i].sequenceRef = sequenceRef;
+      annotations[i].label = labels[r.nextInt(labels.length)];
     }
     long startTime = System.currentTimeMillis();
-    AnnotationSorter testee = new AnnotationSorter(al, false);
-    testee.sort(anns, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
+    AnnotationSorter testee = new AnnotationSorter(alignment, false);
+    testee.sort(annotations, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
     long endTime = System.currentTimeMillis();
     long elapsed = endTime - startTime;
     System.out.println("Sort by label for semisorted " + numSeqs
@@ -364,7 +364,7 @@ public class AnnotationSorterTest
 
     // now resort by sequence
     startTime = System.currentTimeMillis();
-    testee.sort(anns, SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
+    testee.sort(annotations, SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
     endTime = System.currentTimeMillis();
     elapsed = endTime - startTime;
     System.out.println("Resort by sequence for semisorted " + numSeqs
@@ -373,7 +373,7 @@ public class AnnotationSorterTest
 
     // now resort by label
     startTime = System.currentTimeMillis();
-    testee.sort(anns, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
+    testee.sort(annotations, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
     endTime = System.currentTimeMillis();
     elapsed = endTime - startTime;
     System.out.println("Resort by label for semisorted " + numSeqs