file format enum wip changes
[jalview.git] / test / jalview / datamodel / AlignmentTest.java
index 5a45176..4dcf536 100644 (file)
@@ -27,7 +27,9 @@ import static org.testng.AssertJUnit.assertNull;
 import static org.testng.AssertJUnit.assertSame;
 import static org.testng.AssertJUnit.assertTrue;
 
-import jalview.io.AppletFormatAdapter;
+import jalview.io.DataSourceType;
+import jalview.io.FileFormat;
+import jalview.io.FileFormatI;
 import jalview.io.FormatAdapter;
 import jalview.util.MapList;
 
@@ -92,11 +94,11 @@ public class AlignmentTest
    * @return
    * @throws IOException
    */
-  protected AlignmentI loadAlignment(final String data, String format)
+  protected AlignmentI loadAlignment(final String data, FileFormatI format)
           throws IOException
   {
-    AlignmentI a = new FormatAdapter().readFile(data,
-            AppletFormatAdapter.PASTE, format);
+    AlignmentI a = new FormatAdapter().readFile(data, DataSourceType.PASTE,
+            format);
     a.setDataset(null);
     return a;
   }
@@ -108,7 +110,7 @@ public class AlignmentTest
   @BeforeMethod(alwaysRun = true)
   public void setUp() throws IOException
   {
-    al = loadAlignment(TEST_DATA, "STH");
+    al = loadAlignment(TEST_DATA, FileFormat.Stockholm);
     int i = 0;
     for (AlignmentAnnotation ann : al.getAlignmentAnnotation())
     {
@@ -174,9 +176,9 @@ public class AlignmentTest
   public void testAlignAs_dnaAsDna() throws IOException
   {
     // aligned cDNA:
-    AlignmentI al1 = loadAlignment(CDNA_SEQS_1, "FASTA");
+    AlignmentI al1 = loadAlignment(CDNA_SEQS_1, FileFormat.Fasta);
     // unaligned cDNA:
-    AlignmentI al2 = loadAlignment(CDNA_SEQS_2, "FASTA");
+    AlignmentI al2 = loadAlignment(CDNA_SEQS_2, FileFormat.Fasta);
 
     /*
      * Make mappings between sequences. The 'aligned cDNA' is playing the role
@@ -200,8 +202,8 @@ public class AlignmentTest
   public void testAlignAs_proteinAsCdna() throws IOException
   {
     // see also AlignmentUtilsTests
-    AlignmentI al1 = loadAlignment(CDNA_SEQS_1, "FASTA");
-    AlignmentI al2 = loadAlignment(AA_SEQS_1, "FASTA");
+    AlignmentI al1 = loadAlignment(CDNA_SEQS_1, FileFormat.Fasta);
+    AlignmentI al2 = loadAlignment(AA_SEQS_1, FileFormat.Fasta);
     makeMappings(al1, al2);
 
     // Fudge - alignProteinAsCdna expects mappings to be on protein
@@ -224,8 +226,8 @@ public class AlignmentTest
     /*
      * Load alignments and add mappings for cDNA to protein
      */
-    AlignmentI al1 = loadAlignment(CDNA_SEQS_1, "FASTA");
-    AlignmentI al2 = loadAlignment(AA_SEQS_1, "FASTA");
+    AlignmentI al1 = loadAlignment(CDNA_SEQS_1, FileFormat.Fasta);
+    AlignmentI al2 = loadAlignment(AA_SEQS_1, FileFormat.Fasta);
     makeMappings(al1, al2);
 
     /*
@@ -281,8 +283,8 @@ public class AlignmentTest
      * Load alignments and add mappings from nucleotide to protein (or from
      * first to second if both the same type)
      */
-    AlignmentI al1 = loadAlignment(fromSeqs, "FASTA");
-    AlignmentI al2 = loadAlignment(toSeqs, "FASTA");
+    AlignmentI al1 = loadAlignment(fromSeqs, FileFormat.Fasta);
+    AlignmentI al2 = loadAlignment(toSeqs, FileFormat.Fasta);
     makeMappings(al1, al2);
 
     /*
@@ -334,9 +336,9 @@ public class AlignmentTest
     String dna1 = "A-Aa-gG-GCC-cT-TT";
     String dna2 = "c--CCGgg-TT--T-AA-A";
     AlignmentI al1 = loadAlignment(">Dna1/6-17\n" + dna1
-            + "\n>Dna2/20-31\n" + dna2 + "\n", "FASTA");
+            + "\n>Dna2/20-31\n" + dna2 + "\n", FileFormat.Fasta);
     AlignmentI al2 = loadAlignment(
-            ">Pep1/7-9\n-P--YK\n>Pep2/11-13\nG-T--F\n", "FASTA");
+            ">Pep1/7-9\n-P--YK\n>Pep2/11-13\nG-T--F\n", FileFormat.Fasta);
     AlignedCodonFrame acf = new AlignedCodonFrame();
     // Seq1 has intron at dna positions 3,4,9 so splice is AAG GCC TTT
     // Seq2 has intron at dna positions 1,5,6 so splice is CCG TTT AAA
@@ -376,7 +378,7 @@ public class AlignmentTest
   @Test(groups = "Functional")
   public void testCopyConstructor() throws IOException
   {
-    AlignmentI protein = loadAlignment(AA_SEQS_1, FormatAdapter.PASTE);
+    AlignmentI protein = loadAlignment(AA_SEQS_1, FileFormat.Fasta);
     // create sequence and alignment datasets
     protein.setDataset(null);
     AlignedCodonFrame acf = new AlignedCodonFrame();
@@ -411,7 +413,7 @@ public class AlignmentTest
   public void testCreateDatasetAlignment() throws IOException
   {
     AlignmentI protein = new FormatAdapter().readFile(AA_SEQS_1,
-            AppletFormatAdapter.PASTE, "FASTA");
+            DataSourceType.PASTE, FileFormat.Fasta);
     /*
      * create a dataset sequence on first sequence
      * leave the second without one