X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Futil%2FMapListTest.java;h=029b6811df6f26a92c53ddcc091e69e7c0b1b7c8;hb=c5060a3a565a47414ff8d137642df8dd3e0648b0;hp=d2db258583b1cf946c01c5a0d47eacdba93f948a;hpb=8fafc5175547a6d8a38447cff309300b110a1637;p=jalview.git diff --git a/test/jalview/util/MapListTest.java b/test/jalview/util/MapListTest.java index d2db258..029b681 100644 --- a/test/jalview/util/MapListTest.java +++ b/test/jalview/util/MapListTest.java @@ -426,7 +426,7 @@ public class MapListTest @Test(groups = { "Functional" }) public void testGetRanges() { - List ranges = new ArrayList(); + List ranges = new ArrayList<>(); ranges.add(new int[] { 2, 3 }); ranges.add(new int[] { 5, 6 }); assertEquals("[2, 3, 5, 6]", Arrays.toString(MapList.getRanges(ranges))); @@ -603,7 +603,7 @@ public class MapListTest public void testAddRange() { int[] range = { 1, 5 }; - List ranges = new ArrayList(); + List ranges = new ArrayList<>(); // add to empty list: MapList.addRange(range, ranges); @@ -702,7 +702,7 @@ public class MapListTest public void testCoalesceRanges() { assertNull(MapList.coalesceRanges(null)); - List ranges = new ArrayList(); + List ranges = new ArrayList<>(); assertSame(ranges, MapList.coalesceRanges(ranges)); ranges.add(new int[] { 1, 3 }); assertSame(ranges, MapList.coalesceRanges(ranges)); @@ -763,7 +763,7 @@ public class MapListTest @Test(groups = { "Functional" }) public void testCoalesceRanges_withOverlap() { - List ranges = new ArrayList(); + List ranges = new ArrayList<>(); ranges.add(new int[] { 1, 3 }); ranges.add(new int[] { 2, 5 }); @@ -818,7 +818,7 @@ public class MapListTest /** * Test the method that compounds ('traverses') two mappings */ - @Test + @Test(groups = "Functional") public void testTraverse() { /* @@ -940,4 +940,29 @@ public class MapListTest compound = ml1.traverse(ml2); assertNull(compound); } + + /** + * Test that method that inspects for the (first) forward or reverse 'to' range. + * Single position ranges are ignored. + */ + @Test(groups = { "Functional" }) + public void testIsToForwardsStrand() + { + // [3-9] declares forward strand + MapList ml = new MapList(new int[] { 20, 11 }, + new int[] + { 2, 2, 3, 9, 12, 11 }, 1, 1); + assertTrue(ml.isToForwardStrand()); + + // [11-5] declares reverse strand ([13-14] is ignored) + ml = new MapList(new int[] { 20, 11 }, + new int[] + { 2, 2, 11, 5, 13, 14 }, 1, 1); + assertFalse(ml.isToForwardStrand()); + + // all single position ranges - defaults to forward strand + ml = new MapList(new int[] { 3, 1 }, new int[] { 2, 2, 4, 4, 6, 6 }, 1, + 1); + assertTrue(ml.isToForwardStrand()); + } }