import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertSame;
import static org.testng.AssertJUnit.assertTrue;
import jalview.io.AppletFormatAdapter;
import jalview.util.MapList;
import java.io.IOException;
+import java.util.Collections;
import java.util.Iterator;
import org.testng.annotations.BeforeMethod;
assertEquals("c--CCGgg-TT--T------AA-A", al1.getSequenceAt(1)
.getSequenceAsString());
}
+
+ @Test(groups = "Functional")
+ public void testCopyConstructor() throws IOException
+ {
+ AlignmentI protein = loadAlignment(AA_SEQS_1, FormatAdapter.PASTE);
+ protein.setDataset(null);
+ AlignedCodonFrame acf = new AlignedCodonFrame();
+ protein.getDataset().setCodonFrames(Collections.singleton(acf));
+ AlignmentI copy = new Alignment(protein);
+
+ /*
+ * copy has different aligned sequences but the same dataset sequences
+ */
+ assertFalse(copy.getSequenceAt(0) == protein.getSequenceAt(0));
+ assertFalse(copy.getSequenceAt(1) == protein.getSequenceAt(1));
+ assertSame(copy.getSequenceAt(0).getDatasetSequence(), protein
+ .getSequenceAt(0).getDatasetSequence());
+ assertSame(copy.getSequenceAt(1).getDatasetSequence(), protein
+ .getSequenceAt(1).getDatasetSequence());
+ // and the same alignment dataset (?)
+ // or a new one with the same dataset sequences?
+ assertSame(copy.getDataset(), protein.getDataset());
+ }
}