X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Futil%2FMapListTest.java;fp=test%2Fjalview%2Futil%2FMapListTest.java;h=d1a9fae42f75b0cf4258f72a2b15305f936b96d1;hb=3a4d2efc973d71614e600ad00f2f32ee65eb821f;hp=4017055d2cc3bf0f717f543f99daa0271c76064c;hpb=13a51d07c7bdc6d567eff0eea3bb7ee36edee34a;p=jalview.git diff --git a/test/jalview/util/MapListTest.java b/test/jalview/util/MapListTest.java index 4017055..d1a9fae 100644 --- a/test/jalview/util/MapListTest.java +++ b/test/jalview/util/MapListTest.java @@ -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 ranges = new ArrayList<>(); + assertNull(MapList.traverseToPosition(ranges, 0)); + + ranges.add(new int[] { 3, 6 }); + assertNull(MapList.traverseToPosition(ranges, 0)); + } }