X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fdatamodel%2FMappingTest.java;h=0bf753d999126b5b048f39d616246954a2e0443b;hb=refs%2Fheads%2Fpatch%2FJAL-4062_sort_and_merge_contiguousregions;hp=3131ad76141e7152599d755932884fa511e6dc15;hpb=d6eb02943c3388257841b208e1fb65bd4c0be3b7;p=jalview.git diff --git a/test/jalview/datamodel/MappingTest.java b/test/jalview/datamodel/MappingTest.java index 3131ad7..0bf753d 100644 --- a/test/jalview/datamodel/MappingTest.java +++ b/test/jalview/datamodel/MappingTest.java @@ -21,11 +21,14 @@ package jalview.datamodel; import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertSame; +import jalview.gui.JvOptionPane; import jalview.util.MapList; import java.util.Arrays; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; /** @@ -33,6 +36,14 @@ import org.testng.annotations.Test; */ public class MappingTest { + + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + /** * trite test of the intersectVisContigs method for a simple DNA -> Protein * exon map and a range of visContigs @@ -40,11 +51,13 @@ public class MappingTest @Test(groups = { "Functional" }) public void testIntersectVisContigs() { - MapList fk = new MapList(new int[] { 1, 6, 8, 13, 15, 23 }, new int[] { - 1, 7 }, 3, 1); + MapList fk = new MapList(new int[] { 1, 6, 8, 13, 15, 23 }, + new int[] + { 1, 7 }, 3, 1); Mapping m = new Mapping(fk); - Mapping m_1 = m.intersectVisContigs(new int[] { fk.getFromLowest(), - fk.getFromHighest() }); + Mapping m_1 = m + .intersectVisContigs(new int[] + { fk.getFromLowest(), fk.getFromHighest() }); Mapping m_2 = m.intersectVisContigs(new int[] { 1, 7, 11, 20 }); // assertions from output values 'as is', not checked for correctness @@ -75,4 +88,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()); + } }