JAL-3253 temporary branch SwingJS upgrade with testNG fixes Java 8
[jalview.git] / test / jalview / project / Jalview2xmlTests.java
index 830a759..eef44de 100644 (file)
@@ -32,6 +32,7 @@ import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
 import jalview.api.FeatureColourI;
 import jalview.api.ViewStyleI;
+import jalview.bin.Jalview;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.HiddenSequences;
@@ -68,6 +69,7 @@ import jalview.schemes.RNAHelicesColour;
 import jalview.schemes.StrandColourScheme;
 import jalview.schemes.TCoffeeColourScheme;
 import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureMapping;
 import jalview.util.matcher.Condition;
 import jalview.viewmodel.AlignmentViewport;
 
@@ -90,6 +92,12 @@ import org.testng.annotations.Test;
 public class Jalview2xmlTests extends Jalview2xmlBase
 {
 
+  @BeforeClass(alwaysRun = true)
+  public void setUpJalviewSynchonization()
+  {
+    Jalview.setSynchronous(true);
+  }
+
   @Override
   @BeforeClass(alwaysRun = true)
   public void setUpJvOptionPane()
@@ -119,7 +127,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     assertTrue(af.isSaveAlignmentSuccessful(),
             "Failed to store as a project.");
     af.closeMenuItem_actionPerformed(true);
-    af = null;
     af = new FileLoader().LoadFileWaitTillLoaded(tfile,
             DataSourceType.FILE);
     assertNotNull(af, "Failed to import new project");
@@ -154,15 +161,13 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     assertNotNull(
             ColourSchemeProperty.getColourScheme(viewport,
                     viewport.getAlignment(),
-                    viewport.getGlobalColourScheme()
-                            .getSchemeName()),
+                    viewport.getGlobalColourScheme().getSchemeName()),
             "Recognise T-Coffee score from string");
 
     af.saveAlignment(tfile, FileFormat.Jalview);
     assertTrue(af.isSaveAlignmentSuccessful(),
             "Failed to store as a project.");
     af.closeMenuItem_actionPerformed(true);
-    af = null;
     af = new FileLoader().LoadFileWaitTillLoaded(tfile,
             DataSourceType.FILE);
     assertNotNull(af, "Failed to import new project");
@@ -294,10 +299,10 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     // count number of PDB mappings the structure selection manager holds -
     String pdbFile = af.getCurrentView().getStructureSelectionManager()
             .findFileForPDBId("1A70");
-    assertEquals(
-            af.getCurrentView().getStructureSelectionManager()
-                    .getMapping(pdbFile).length,
-            2, "Expected only two mappings for 1A70");
+    StructureMapping[] x = af.getCurrentView()
+            .getStructureSelectionManager()//
+            .getMapping(pdbFile);
+    assertEquals(x.length, 2, "Expected only two mappings for 1A70");
 
   }
 
@@ -406,7 +411,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   public void testStoreAndRecoverExpandedviews() throws Exception
   {
     Desktop.getInstance().closeAll_actionPerformed(null);
-
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
             "examples/exampleFile_2_7.jar", DataSourceType.FILE);
     Assert.assertEquals(Desktop.getAlignFrames().length, 1);
@@ -444,9 +448,8 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     Assert.assertEquals(Desktop.getAlignFrames().length,
             Desktop.getAlignmentPanels(
                     af.getViewport().getSequenceSetId()).length);
-    Assert.assertEquals(
-            Desktop.getAlignmentPanels(
-                    af.getViewport().getSequenceSetId()).length,
+    Assert.assertEquals(Desktop
+            .getAlignmentPanels(af.getViewport().getSequenceSetId()).length,
             oldviews);
   }
 
@@ -1083,7 +1086,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   {
     Desktop.getInstance().closeAll_actionPerformed(null);
 
-    // complex project - one dataset, several views on several alignments
+    // complex project - one dataset, several views on several alignment
     AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded(
             "examples/testdata/projects/manyViews.jvp",
             DataSourceType.FILE);