JAL-4334 failing test using whole of Q29079 accession. Can be trimmed.
[jalview.git] / test / jalview / gui / FeatureSettingsTest.java
index 98c04b3..12c4c6c 100644 (file)
@@ -42,7 +42,10 @@ import jalview.datamodel.features.FeatureMatcher;
 import jalview.datamodel.features.FeatureMatcherSet;
 import jalview.datamodel.features.FeatureMatcherSetI;
 import jalview.io.DataSourceType;
+import jalview.io.FileFormat;
+import jalview.io.FileFormatI;
 import jalview.io.FileLoader;
+import jalview.io.IdentifyFile;
 import jalview.schemes.FeatureColour;
 import jalview.schemes.FeatureColourTest;
 import jalview.util.matcher.Condition;
@@ -57,13 +60,14 @@ public class FeatureSettingsTest
      * use read-only test properties file
      */
     Cache.loadProperties("test/jalview/io/testProps.jvprops");
-    Jalview.main(new String[] { "-nonews" });
+    Jalview.main(new String[] { "--nonews" });
   }
 
   @AfterMethod(alwaysRun = true)
   public void tearDown()
   {
-    Desktop.instance.closeAll_actionPerformed(null);
+    if (Desktop.instance != null)
+      Desktop.instance.closeAll_actionPerformed(null);
   }
 
   /**
@@ -277,4 +281,19 @@ public class FeatureSettingsTest
             "<html>By Score (&gt; 4.0)<br>" + simpleTooltip
                     + "</br></html>");
   }
+
+  String fsfile = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ns2:JalviewUserColours schemeName=\"Sequence Features\" xmlns:ns2=\"www.jalview.org/colours\">",
+          fsfile2 = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<ns2:JalviewUserColours schemeName=\"Sequence Features\" xmlns:ns2=\"www.jalview.org/colours\">";
+
+  @Test(groups = "Functional")
+  public void testIdentifyFeatureSettingsFile() throws Exception
+  {
+    FileFormatI type = new IdentifyFile().identify(fsfile,
+            DataSourceType.PASTE);
+    assertTrue(FileFormat.FeatureSettings == type,
+            "Feature settings file was identified as " + type);
+    type = new IdentifyFile().identify(fsfile2, DataSourceType.PASTE);
+    assertTrue(FileFormat.FeatureSettings == type,
+            "Feature settings file with newline was identified as " + type);
+  }
 }