JAL-629 fixed a test failing when run without a Jalview.main() having been started...
authorBen Soares <b.soares@dundee.ac.uk>
Thu, 16 Mar 2023 10:41:20 +0000 (10:41 +0000)
committerBen Soares <b.soares@dundee.ac.uk>
Thu, 16 Mar 2023 10:41:20 +0000 (10:41 +0000)
test/jalview/gui/FeatureSettingsTest.java

index f0b3aef..98c04b3 100644 (file)
@@ -29,9 +29,13 @@ import java.io.File;
 import java.io.IOException;
 import java.util.HashMap;
 
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
 import jalview.api.FeatureColourI;
+import jalview.bin.Cache;
+import jalview.bin.Jalview;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
 import jalview.datamodel.features.FeatureMatcher;
@@ -46,6 +50,22 @@ import jalview.viewmodel.seqfeatures.FeatureRendererModel;
 
 public class FeatureSettingsTest
 {
+  @BeforeClass(alwaysRun = true)
+  public static void setUpBeforeClass() throws Exception
+  {
+    /*
+     * use read-only test properties file
+     */
+    Cache.loadProperties("test/jalview/io/testProps.jvprops");
+    Jalview.main(new String[] { "-nonews" });
+  }
+
+  @AfterMethod(alwaysRun = true)
+  public void tearDown()
+  {
+    Desktop.instance.closeAll_actionPerformed(null);
+  }
+
   /**
    * Test a roundtrip of save and reload of feature colours and filters as XML
    *