JAL-3253 code tidies and tweaks to Desktop
[jalview.git] / test / jalview / analysis / AlignmentSorterTest.java
index 088611e..090ae1a 100644 (file)
@@ -11,10 +11,10 @@ import jalview.datamodel.SequenceI;
 import java.util.Arrays;
 import java.util.List;
 
-import junit.extensions.PA;
-
 import org.testng.annotations.Test;
 
+import junit.extensions.PA;
+
 public class AlignmentSorterTest
 {
   @Test(groups = "Functional")
@@ -31,10 +31,12 @@ public class AlignmentSorterTest
     /*
      * sort with no score features does nothing
      */
-    PA.setValue(AlignmentSorter.class, "lastSortByFeatureScore", null);
+    AlignmentSorter sorter = (AlignmentSorter) PA
+            .invokeMethod(AlignmentSorter.class, "getInstance()",
+                    new Object[] {});
+    PA.setValue(sorter, "sortByFeatureCriteria", null);
 
-    AlignmentSorter.sortByFeature((String) null, null, 0, al.getWidth(),
-            al,
+    AlignmentSorter.sortByFeature(null, null, 0, al.getWidth(), al,
             AlignmentSorter.FEATURE_SCORE);
     assertSame(al.getSequenceAt(0), seq1);
     assertSame(al.getSequenceAt(1), seq2);
@@ -65,9 +67,9 @@ public class AlignmentSorterTest
      * sort by ascending score, no filter on feature type or group
      * NB sort order for the same feature set (none) gets toggled, so descending
      */
-    PA.setValue(AlignmentSorter.class, "sortByFeatureScoreAscending", true);
-    AlignmentSorter.sortByFeature((String) null, null, 0, al.getWidth(),
-            al, AlignmentSorter.FEATURE_SCORE);
+    PA.setValue(sorter, "sortByFeatureAscending", true);
+    AlignmentSorter.sortByFeature(null, null, 0, al.getWidth(), al,
+            AlignmentSorter.FEATURE_SCORE);
     assertSame(al.getSequenceAt(3), seq3); // -0.5
     assertSame(al.getSequenceAt(2), seq2); // 2.5
     assertSame(al.getSequenceAt(1), seq1); // 3.0
@@ -76,8 +78,8 @@ public class AlignmentSorterTest
     /*
      * repeat sort toggles order - now ascending
      */
-    AlignmentSorter.sortByFeature((String) null, null, 0, al.getWidth(),
-            al, AlignmentSorter.FEATURE_SCORE);
+    AlignmentSorter.sortByFeature(null, null, 0, al.getWidth(), al,
+            AlignmentSorter.FEATURE_SCORE);
     assertSame(al.getSequenceAt(0), seq3); // -0.5
     assertSame(al.getSequenceAt(1), seq2); // 2.5
     assertSame(al.getSequenceAt(2), seq1); // 3.0
@@ -116,7 +118,7 @@ public class AlignmentSorterTest
      */
     // fails because seq1.findPosition(4) returns 4
     // although residue 4 is in column 5! - JAL-2544
-    AlignmentSorter.sortByFeature((String) null, null, 0, 4, al,
+    AlignmentSorter.sortByFeature(null, null, 0, 4, al,
             AlignmentSorter.FEATURE_SCORE);
     assertSame(al.getSequenceAt(0), seq3); // -4
     assertSame(al.getSequenceAt(1), seq1); // 2.0