JAL-2110 add 'mapFromId' to Mapping (for e.g. EMBL CDS protein_id)
[jalview.git] / test / jalview / datamodel / MappingTest.java
index 3131ad7..b326d90 100644 (file)
@@ -21,6 +21,7 @@
 package jalview.datamodel;
 
 import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertSame;
 
 import jalview.util.MapList;
 
@@ -75,4 +76,18 @@ public class MappingTest
     m = new Mapping(seq, fk);
     assertEquals("[ [1, 6] [8, 13] ] 3:1 to [ [4, 7] ] Seq1", m.toString());
   }
+
+  @Test(groups = { "Functional" })
+  public void testCopyConstructor()
+  {
+    MapList ml = new MapList(new int[] { 1, 6, 8, 13 }, new int[] { 4, 7 },
+            3, 1);
+    SequenceI seq = new Sequence("seq1", "agtacg");
+    Mapping m = new Mapping(seq, ml);
+    m.setMappedFromId("abc");
+    Mapping copy = new Mapping(m);
+    assertEquals("abc", copy.getMappedFromId());
+    assertEquals(ml, copy.getMap());
+    assertSame(seq, copy.getTo());
+  }
 }