+package jalview.structure;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.testng.annotations.Test;
+
+public class StructureMappingTest
+{
+ @Test(groups = "Functional")
+ public void testgetPDBResNumRanges()
+ {
+ HashMap<Integer, int[]> map = new HashMap<Integer, int[]>();
+
+ StructureMapping mapping = new StructureMapping(null, null, null, null,
+ map, null);
+
+ List<int[]> ranges = mapping.getPDBResNumRanges(1, 2);
+ assertTrue(ranges.isEmpty());
+
+ map.put(1, new int[] { 12, 20 }); // 1 maps to 12
+ ranges = mapping.getPDBResNumRanges(2, 3);
+ assertTrue(ranges.isEmpty());
+ ranges = mapping.getPDBResNumRanges(1, 2);
+ assertEquals(ranges.size(), 1);
+ assertEquals(ranges.get(0)[0], 12);
+ assertEquals(ranges.get(0)[1], 12);
+
+ map.put(2, new int[] { 13, 20 }); // 2 maps to 13
+ ranges = mapping.getPDBResNumRanges(1, 2);
+ assertEquals(ranges.size(), 1);
+ assertEquals(ranges.get(0)[0], 12);
+ assertEquals(ranges.get(0)[1], 13);
+
+ map.put(3, new int[] { 15, 20 }); // 3 maps to 15 - break
+ ranges = mapping.getPDBResNumRanges(1, 5);
+ assertEquals(ranges.size(), 2);
+ assertEquals(ranges.get(0)[0], 12);
+ assertEquals(ranges.get(0)[1], 13);
+ assertEquals(ranges.get(1)[0], 15);
+ assertEquals(ranges.get(1)[1], 15);
+ }
+}