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