JAL-3751 only merge strictly contiguous ranges of mappings
[jalview.git] / test / jalview / util / MappingUtilsTest.java
index 813edf8..d0269d8 100644 (file)
@@ -37,6 +37,7 @@ import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
 import jalview.api.AlignViewportI;
+import jalview.bin.Cache;
 import jalview.commands.EditCommand;
 import jalview.commands.EditCommand.Action;
 import jalview.commands.EditCommand.Edit;
@@ -59,6 +60,12 @@ import jalview.io.FormatAdapter;
 
 public class MappingUtilsTest
 {
+  @BeforeClass(alwaysRun = true)
+  public void setUp()
+  {
+    Cache.initLogger();
+  }
+  
 
   @BeforeClass(alwaysRun = true)
   public void setUpJvOptionPane()
@@ -1355,7 +1362,8 @@ public class MappingUtilsTest
   /**
    * Test mapping a sequence group where sequences in and outside the group
    * share a dataset sequence (e.g. alternative CDS for the same gene)
-   * 
+   * <p>
+   * This scenario doesn't arise after JAL-3763 changes, but test left as still valid
    * @throws IOException
    */
   @Test(groups = { "Functional" })
@@ -1377,6 +1385,9 @@ public class MappingUtilsTest
     SequenceI pep1 = new Sequence("pep1", "KF");
     SequenceI pep2 = new Sequence("pep2", "FG");
     SequenceI pep3 = new Sequence("pep3", "GP");
+    pep1.createDatasetSequence();
+    pep2.createDatasetSequence();
+    pep3.createDatasetSequence();
 
     /*
      * add mappings from coding positions of dna to respective peptides
@@ -1401,7 +1412,7 @@ public class MappingUtilsTest
             new SequenceI[]
             { pep1, pep2, pep3 });
     AlignViewportI cdnaView = new AlignViewport(cdna);
-    AlignViewportI proteinView = new AlignViewport(protein);
+    AlignViewportI peptideView = new AlignViewport(protein);
     protein.setCodonFrames(acfList);
 
     /*
@@ -1419,7 +1430,7 @@ public class MappingUtilsTest
      * Verify the mapped sequence group in dna is cds1 and cds3
      */
     SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg,
-            proteinView, cdnaView);
+            peptideView, cdnaView);
     assertTrue(mappedGroup.getColourText());
     assertSame(sg.getIdColour(), mappedGroup.getIdColour());
     assertSame(sg.getOutlineColour(), mappedGroup.getOutlineColour());
@@ -1438,7 +1449,7 @@ public class MappingUtilsTest
     sg.addSequence(cds1, false);
     sg.setStartRes(0);
     sg.setEndRes(cdna.getWidth() - 1);
-    mappedGroup = MappingUtils.mapSequenceGroup(sg, cdnaView, proteinView);
+    mappedGroup = MappingUtils.mapSequenceGroup(sg, cdnaView, peptideView);
     assertTrue(mappedGroup.getColourText());
     assertSame(sg.getIdColour(), mappedGroup.getIdColour());
     assertSame(sg.getOutlineColour(), mappedGroup.getOutlineColour());