JAL-1645 source formatting and organise imports
[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[] { 1, 6, 8, 13, 15, 23 }, new int[] {
24         1, 7 }, 3, 1);
25     Mapping m = new Mapping(fk);
26     Mapping m_1 = m.intersectVisContigs(new int[] { fk.getFromLowest(),
27         fk.getFromHighest() });
28     Mapping m_2 = m.intersectVisContigs(new int[] { 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().toArray());
32     System.out.println(result);
33     assertEquals("[[1, 6], [8, 13], [15, 23]]", result);
34
35     result = Arrays.deepToString(m_2.map.getFromRanges().toArray());
36     System.out.println(result);
37     assertEquals("[[1, 6], [11, 13], [15, 20]]", result);
38   }
39
40 }