1 package jalview.structure;
3 import static org.testng.Assert.assertEquals;
4 import static org.testng.Assert.assertTrue;
6 import java.util.HashMap;
9 import org.testng.annotations.Test;
11 public class StructureMappingTest
13 @Test(groups = "Functional")
14 public void testgetPDBResNumRanges()
16 HashMap<Integer, int[]> map = new HashMap<Integer, int[]>();
18 StructureMapping mapping = new StructureMapping(null, null, null, null,
21 List<int[]> ranges = mapping.getPDBResNumRanges(1, 2);
22 assertTrue(ranges.isEmpty());
24 map.put(1, new int[] { 12, 20 }); // 1 maps to 12
25 ranges = mapping.getPDBResNumRanges(2, 3);
26 assertTrue(ranges.isEmpty());
27 ranges = mapping.getPDBResNumRanges(1, 2);
28 assertEquals(ranges.size(), 1);
29 assertEquals(ranges.get(0)[0], 12);
30 assertEquals(ranges.get(0)[1], 12);
32 map.put(2, new int[] { 13, 20 }); // 2 maps to 13
33 ranges = mapping.getPDBResNumRanges(1, 2);
34 assertEquals(ranges.size(), 1);
35 assertEquals(ranges.get(0)[0], 12);
36 assertEquals(ranges.get(0)[1], 13);
38 map.put(3, new int[] { 15, 20 }); // 3 maps to 15 - break
39 ranges = mapping.getPDBResNumRanges(1, 5);
40 assertEquals(ranges.size(), 2);
41 assertEquals(ranges.get(0)[0], 12);
42 assertEquals(ranges.get(0)[1], 13);
43 assertEquals(ranges.get(1)[0], 15);
44 assertEquals(ranges.get(1)[1], 15);