JAL-1805 test envirionment separation
[jalview.git] / test / jalview / datamodel / MappingTest.java
1 package jalview.datamodel;
2
3 import static org.testng.AssertJUnit.assertEquals;
4
5 import jalview.util.MapList;
6
7 import java.util.Arrays;
8
9 import org.testng.annotations.Test;
10
11 /**
12  * Test class refactored from main method
13  */
14 public class MappingTest
15 {
16   /**
17    * trite test of the intersectVisContigs method for a simple DNA -> Protein
18    * exon map and a range of visContigs
19    */
20   @Test(groups ={ "Functional" })
21   public void testIntersectVisContigs()
22   {
23     MapList fk = new MapList(new int[]
24     { 1, 6, 8, 13, 15, 23 }, new int[]
25     { 1, 7 }, 3, 1);
26     Mapping m = new Mapping(fk);
27     Mapping m_1 = m.intersectVisContigs(new int[]
28     { fk.getFromLowest(), fk.getFromHighest() });
29     Mapping m_2 = m.intersectVisContigs(new int[]
30     { 1, 7, 11, 20 });
31
32     // assertions from output values 'as is', not checked for correctness
33     String result = Arrays.deepToString(m_1.map.getFromRanges()
34             .toArray());
35     System.out.println(result);
36     assertEquals("[[1, 6], [8, 13], [15, 23]]", result);
37
38     result = Arrays.deepToString(m_2.map.getFromRanges().toArray());
39     System.out.println(result);
40     assertEquals("[[1, 6], [11, 13], [15, 20]]", result);
41   }
42
43 }