JAL-629 null checks for Desktop.instance.closeAll(). Props re-loaded after CommandsTest.
[jalview.git] / test / jalview / project / Jalview2xmlTests.java
index 510b21d..094e0ea 100644 (file)
@@ -110,6 +110,8 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   @BeforeClass(alwaysRun = true)
   public void setUpJvOptionPane()
   {
+    if (Desktop.instance != null)
+      Desktop.instance.closeAll_actionPerformed(null);
     JvOptionPane.setInteractiveMode(false);
     JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
   }
@@ -285,6 +287,8 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   {
     int origCount = Desktop.getAlignFrames() == null ? 0
             : Desktop.getAlignFrames().length;
+    System.out
+            .println("###### Calling FileLoader().LoadFileWaitTillLoaded");
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
             "examples/exampleFile_2_7.jar", DataSourceType.FILE);
     assertNotNull(af, "Didn't read in the example file correctly.");
@@ -1564,10 +1568,12 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     }
     PAEContactMatrix dummyMat = new PAEContactMatrix(sq, paevals);
     String content = ContactMatrix.contactToFloatString(dummyMat);
-    Assert.assertTrue(content.contains("\t1.")); // at least one element must be 1
-    float[][] vals = ContactMatrix.fromFloatStringToContacts(content, sq.getLength(), sq.getLength());
-    assertEquals(vals[3][4],paevals[3][4]);
-    
+    Assert.assertTrue(content.contains("\t1.")); // at least one element must be
+                                                 // 1
+    float[][] vals = ContactMatrix.fromFloatStringToContacts(content,
+            sq.getLength(), sq.getLength());
+    assertEquals(vals[3][4], paevals[3][4]);
+
     AlignmentAnnotation paeCm = sq.addContactList(dummyMat);
     al.addAnnotation(paeCm);
     File tfile = File.createTempFile("testStoreAndRecoverPAEmatrix",
@@ -1598,7 +1604,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
         Assert.assertEquals(oldCM.getContactAt(j), newCM.getContactAt(j));
       }
     }
-    
+
   }
 
 }