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