JAL-3761 failing test, formatting, method renamed
[jalview.git] / test / jalview / util / MapListTest.java
index 4017055..d1a9fae 100644 (file)
@@ -44,7 +44,7 @@ public class MapListTest
   {
     Cache.initLogger();
   }
-  
+
   @BeforeClass(alwaysRun = true)
   public void setUpJvOptionPane()
   {
@@ -596,7 +596,8 @@ public class MapListTest
   public void testAddMapList_sameMap()
   {
     MapList ml = new MapList(new int[] { 11, 15, 20, 25, 35, 30 },
-            new int[] { 72, 22 }, 1, 3);
+            new int[]
+            { 72, 22 }, 1, 3);
     String before = ml.toString();
     ml.addMapList(ml);
     assertEquals(before, ml.toString());
@@ -779,11 +780,11 @@ public class MapListTest
     assertArrayEquals(new int[] { 5, 6 }, merged.get(1));
     assertArrayEquals(new int[] { 12, 8 }, merged.get(2));
     assertArrayEquals(new int[] { 8, 7 }, merged.get(3));
-    
+
     // 'subsumed' ranges are preserved
     ranges.clear();
     ranges.add(new int[] { 10, 30 });
-    ranges.add(new int[] { 15, 25 }); 
+    ranges.add(new int[] { 15, 25 });
     merged = MapList.coalesceRanges(ranges);
     assertEquals(2, merged.size());
     assertArrayEquals(new int[] { 10, 30 }, merged.get(0));
@@ -980,7 +981,7 @@ public class MapListTest
     assertEquals("[1, 12, 12, 17]", Arrays.toString(ml.locateInFrom(1, 6)));
     assertEquals("[4, 9]", Arrays.toString(ml.locateInFrom(2, 3)));
     assertEquals("[7, 12, 12, 17]", Arrays.toString(ml.locateInFrom(3, 6)));
-  
+
     assertNull(ml.locateInFrom(0, 0));
     assertNull(ml.locateInFrom(1, 7));
     assertNull(ml.locateInFrom(-1, 1));
@@ -999,15 +1000,25 @@ public class MapListTest
     assertEquals("[1, 3]", Arrays.toString(ml.locateInTo(3, 8)));
     assertEquals("[1, 4]", Arrays.toString(ml.locateInTo(2, 11)));
     assertEquals("[1, 4]", Arrays.toString(ml.locateInTo(3, 11)));
-    
-    // we want 'greedy' mapping of base 12 to both peptides it codes for
+
+    // we want base 12 to map to both of the amino acids it codes for
     assertEquals("[4, 5]", Arrays.toString(ml.locateInTo(12, 12)));
     assertEquals("[4, 5]", Arrays.toString(ml.locateInTo(11, 12)));
     assertEquals("[4, 6]", Arrays.toString(ml.locateInTo(11, 15)));
     assertEquals("[6, 6]", Arrays.toString(ml.locateInTo(15, 17)));
-  
+
     assertNull(ml.locateInTo(0, 0));
     assertNull(ml.locateInTo(1, 18));
     assertNull(ml.locateInTo(-1, 1));
   }
+
+  @Test(groups = { "Functional" })
+  public void testTraverseToPosition()
+  {
+    List<int[]> ranges = new ArrayList<>();
+    assertNull(MapList.traverseToPosition(ranges, 0));
+
+    ranges.add(new int[] { 3, 6 });
+    assertNull(MapList.traverseToPosition(ranges, 0));
+  }
 }