JAL-653 test for 'groups file' and mixed Jalview/GFF
[jalview.git] / test / jalview / io / IdentifyFileTest.java
index 5e376a6..965226a 100644 (file)
@@ -31,7 +31,7 @@ public class IdentifyFileTest
 {
 
   @Test(groups = { "Functional" }, dataProvider = "identifyFiles")
-  public void Identify(String data, String expectedFileType)
+  public void testIdentify(String data, String expectedFileType)
   {
     String protocol = AppletFormatAdapter.FILE;
     IdentifyFile ider = new IdentifyFile();
@@ -40,6 +40,28 @@ public class IdentifyFileTest
             "File identification Failed!");
   }
 
+  /**
+   * Additional tests for (a) Jalview features file with no colour
+   * specifications (old style 'groups' file) and (b) Jalview features file with
+   * embedded GFF
+   */
+  @Test(groups = "Functional")
+  public void testIdentify_featureFile()
+  {
+    IdentifyFile ider = new IdentifyFile();
+
+    // Jalview format with features only, no feature colours
+    String data = "Iron-sulfur (2Fe-2S)\tFER_CAPAA\t-1\t39\t39\tMETAL\n"
+            + "Iron-phosphorus (2Fe-P)\tID_NOT_SPECIFIED\t2\t86\t87\tMETALLIC\n";
+    Assert.assertEquals(IdentifyFile.FeaturesFile, ider.identify(data, AppletFormatAdapter.PASTE));
+
+    // Jalview feature colour followed by GFF format feature data
+    data = "METAL\tcc9900\n" + "GFF\n"
+            + "FER_CAPAA\tuniprot\tMETAL\t44\t45\t4.0\t.\t.\n";
+    Assert.assertEquals(IdentifyFile.FeaturesFile,
+            ider.identify(data, AppletFormatAdapter.PASTE));
+  }
+
   @DataProvider(name = "identifyFiles")
   public Object[][] IdentifyFileDP()
   {
@@ -59,8 +81,6 @@ public class IdentifyFileTest
         { "examples/testdata/test.blc", "BLC" },
         { "examples/exampleFeatures.txt", IdentifyFile.FeaturesFile },
         { "examples/testdata/simplegff3.gff", IdentifyFile.FeaturesFile },
-        { "examples/testdata/exampleFeaturesMixed.gff",
-            IdentifyFile.FeaturesFile },
         { "examples/testdata/test.jvp", "Jalview" },
         {
             "examples/testdata/cullpdb_pc25_res3.0_R0.3_d150729_chains9361.fasta.15316",