JAL-1619 refactoring in progress for Dna translation
[jalview.git] / test / jalview / datamodel / AlignedCodonFrameTest.java
1 package jalview.datamodel;
2
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertSame;
5 import jalview.util.MapList;
6
7 import org.junit.Test;
8
9 public class AlignedCodonFrameTest
10 {
11
12   /**
13    * Test the constructor which copies all except the aligned protein sequences.
14    */
15   @Test
16   public void testConstructor_copyWithSequence()
17   {
18     AlignedCodonFrame acf = new AlignedCodonFrame(0);
19     acf.codons = new int[][]
20     { new int[]
21     { 1, 3 }, new int[]
22     { 4, 6 } };
23     MapList map = new MapList(new int[]
24     { 1, 3 }, new int[]
25     { 1, 1 }, 3, 1);
26     SequenceI aaseq = new Sequence("", "FKQ");
27     SequenceI dnaseq = new Sequence("", "ATTCGTACGGAC");
28     acf.addMap(dnaseq, aaseq, map);
29     SequenceI[] newaligned = new SequenceI[1];
30     newaligned[0] = new Sequence("", "-F-K-Q");
31     newaligned[0].setDatasetSequence(aaseq.getDatasetSequence());
32     AlignedCodonFrame copy = new AlignedCodonFrame(acf, newaligned);
33     assertSame(copy.codons, acf.codons);
34     assertEquals(copy.aaWidth, acf.aaWidth);
35     assertSame(copy.getdnaSeqs(), acf.getdnaSeqs());
36     assertSame(newaligned[0], copy.getAaForDnaSeq(dnaseq, false));
37   }
38 }