From 82174e483ca40892252a783eeef9b4d686a33b00 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Tue, 21 Mar 2023 19:54:47 +0000 Subject: [PATCH] JAL-629 null checks for Desktop.instance.closeAll(). Props re-loaded after CommandsTest. --- test/jalview/bin/CommandsTest.java | 10 ++++- test/jalview/bin/HiDPISettingTest1.java | 3 +- test/jalview/ext/jmol/JmolViewerTest.java | 16 ++++---- .../ext/rbvi/chimera/JalviewChimeraView.java | 3 +- test/jalview/gui/AlignFrameTest.java | 3 +- test/jalview/gui/FeatureSettingsTest.java | 3 +- test/jalview/gui/FreeUpMemoryTest.java | 3 +- test/jalview/gui/QuitHandlerTest.java | 14 ++----- test/jalview/gui/SeqPanelTest.java | 5 ++- test/jalview/io/AnnotatedPDBFileInputTest.java | 23 +++++------ test/jalview/io/CrossRef2xmlTests.java | 40 ++++++++++---------- test/jalview/io/Jalview2xmlBase.java | 15 ++++---- test/jalview/io/JalviewExportPropertiesTests.java | 12 +++--- test/jalview/project/Jalview2xmlTests.java | 16 +++++--- .../renderer/seqfeatures/FeatureRendererTest.java | 27 ++++++++----- test/jalview/schemes/ColourSchemesTest.java | 19 +++++----- .../structure/StructureSelectionManagerTest.java | 3 +- 17 files changed, 123 insertions(+), 92 deletions(-) diff --git a/test/jalview/bin/CommandsTest.java b/test/jalview/bin/CommandsTest.java index 65162f3..c5f8bff 100644 --- a/test/jalview/bin/CommandsTest.java +++ b/test/jalview/bin/CommandsTest.java @@ -3,6 +3,7 @@ package jalview.bin; import java.util.Date; import org.testng.Assert; +import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; @@ -24,6 +25,12 @@ public class CommandsTest Cache.setDateProperty("JALVIEW_NEWS_RSS_LASTMODIFIED", oneHourFromNow); } + @AfterClass(alwaysRun = true) + public static void resetProps() + { + Cache.loadProperties("test/jalview/testProps.jvprops"); + } + @BeforeClass(alwaysRun = true) public void setUpJvOptionPane() { @@ -34,7 +41,8 @@ public class CommandsTest @AfterMethod(alwaysRun = true) public void tearDown() { - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = "Functional", dataProvider = "cmdLines") diff --git a/test/jalview/bin/HiDPISettingTest1.java b/test/jalview/bin/HiDPISettingTest1.java index 4561ff4..49a721f 100644 --- a/test/jalview/bin/HiDPISettingTest1.java +++ b/test/jalview/bin/HiDPISettingTest1.java @@ -85,7 +85,8 @@ public class HiDPISettingTest1 @AfterClass(alwaysRun = true) public void tearDown() { - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }) diff --git a/test/jalview/ext/jmol/JmolViewerTest.java b/test/jalview/ext/jmol/JmolViewerTest.java index e451ed2..9dec19b 100644 --- a/test/jalview/ext/jmol/JmolViewerTest.java +++ b/test/jalview/ext/jmol/JmolViewerTest.java @@ -24,6 +24,12 @@ import static org.junit.Assert.assertNotNull; import static org.testng.Assert.assertEquals; import static org.testng.AssertJUnit.assertTrue; +import java.lang.reflect.InvocationTargetException; + +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.bin.Jalview; @@ -31,6 +37,7 @@ import jalview.datamodel.PDBEntry; import jalview.datamodel.SearchResultsI; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; +import jalview.gui.Desktop; import jalview.gui.JvOptionPane; import jalview.gui.Preferences; import jalview.gui.StructureViewer; @@ -39,12 +46,6 @@ import jalview.io.DataSourceType; import jalview.io.FileFormat; import jalview.io.FileLoader; -import java.lang.reflect.InvocationTargetException; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - @Test(singleThreaded = true) public class JmolViewerTest { @@ -74,7 +75,8 @@ public class JmolViewerTest @AfterClass(alwaysRun = true) public static void tearDownAfterClass() throws Exception { - jalview.gui.Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }) diff --git a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java index 7f9aa9b..c8e30a7 100644 --- a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java +++ b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java @@ -100,7 +100,8 @@ public class JalviewChimeraView @AfterClass(alwaysRun = true) public static void tearDownAfterClass() throws Exception { - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); } @AfterMethod(alwaysRun = true) diff --git a/test/jalview/gui/AlignFrameTest.java b/test/jalview/gui/AlignFrameTest.java index 2a768ff..ab2a1d0 100644 --- a/test/jalview/gui/AlignFrameTest.java +++ b/test/jalview/gui/AlignFrameTest.java @@ -75,7 +75,8 @@ public class AlignFrameTest @AfterMethod(alwaysRun = true) public void tearDown() { - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); } /** diff --git a/test/jalview/gui/FeatureSettingsTest.java b/test/jalview/gui/FeatureSettingsTest.java index 98c04b3..1b988ec 100644 --- a/test/jalview/gui/FeatureSettingsTest.java +++ b/test/jalview/gui/FeatureSettingsTest.java @@ -63,7 +63,8 @@ public class FeatureSettingsTest @AfterMethod(alwaysRun = true) public void tearDown() { - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); } /** diff --git a/test/jalview/gui/FreeUpMemoryTest.java b/test/jalview/gui/FreeUpMemoryTest.java index 81e37d8..a9eca49 100644 --- a/test/jalview/gui/FreeUpMemoryTest.java +++ b/test/jalview/gui/FreeUpMemoryTest.java @@ -137,7 +137,8 @@ public class FreeUpMemoryTest doStuffInJalview(f); - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); checkUsedMemory(MAX_RESIDUAL_HEAP); } diff --git a/test/jalview/gui/QuitHandlerTest.java b/test/jalview/gui/QuitHandlerTest.java index b257088..299b0d1 100644 --- a/test/jalview/gui/QuitHandlerTest.java +++ b/test/jalview/gui/QuitHandlerTest.java @@ -66,7 +66,8 @@ public class QuitHandlerTest // reset mock response JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); // close desktop windows/frames - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); // reset debug delay Jalview2XML.setDebugDelaySave(20); } @@ -79,7 +80,8 @@ public class QuitHandlerTest // reset mock response JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); // close desktop windows/frames - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); // reset debug delay Cache.setProperty("DEBUG_DELAY_SAVE", "false"); Jalview2XML.setDebugDelaySave(3); @@ -126,7 +128,6 @@ public class QuitHandlerTest Assert.assertTrue(end - start < 500, "Quit-with-no-save-needed took too long (" + (end - start) + "ms)"); - Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }, singleThreaded = true, priority = 10) @@ -154,8 +155,6 @@ public class QuitHandlerTest Assert.assertEquals(response, QResponse.QUIT); Assert.assertTrue(end - start > 2900, "Quit-whilst-saving was too short (" + (end - start) + "ms)"); - - Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }, singleThreaded = true, priority = 9) @@ -182,7 +181,6 @@ public class QuitHandlerTest // if not saved this would be CANCEL_QUIT Assert.assertEquals(response, QResponse.QUIT); - Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }, singleThreaded = true, priority = 9) @@ -207,7 +205,6 @@ public class QuitHandlerTest // if not saved this would be CANCEL_QUIT Assert.assertEquals(response, QResponse.QUIT); - Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }, singleThreaded = true, priority = 1) @@ -227,7 +224,6 @@ public class QuitHandlerTest QResponse response = QuitHandler.getQuitResponse(true); Assert.assertEquals(response, QResponse.CANCEL_QUIT); - Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }, singleThreaded = true, priority = 1) @@ -255,7 +251,6 @@ public class QuitHandlerTest QResponse response = QuitHandler.getQuitResponse(false); Assert.assertEquals(response, QResponse.QUIT); - Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }, singleThreaded = true, priority = 11) @@ -298,7 +293,6 @@ public class QuitHandlerTest "Force-Quit-whilst-saving was too long (" + (end - start) + "ms)"); - Desktop.instance.closeAll_actionPerformed(null); } } diff --git a/test/jalview/gui/SeqPanelTest.java b/test/jalview/gui/SeqPanelTest.java index f905ef2..701431b 100644 --- a/test/jalview/gui/SeqPanelTest.java +++ b/test/jalview/gui/SeqPanelTest.java @@ -250,7 +250,8 @@ public class SeqPanelTest @AfterMethod(alwaysRun = true) public void tearDown() { - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = "Functional") @@ -920,7 +921,7 @@ public class SeqPanelTest } assertEquals(dna.length(), 51200); AlignFrame alignFrame = new FileLoader() - .LoadFileWaitTillLoaded("dna "+dna, DataSourceType.PASTE); + .LoadFileWaitTillLoaded("dna " + dna, DataSourceType.PASTE); SeqPanel testee = alignFrame.alignPanel.getSeqPanel(); AlignViewport av = alignFrame.getViewport(); av.setScaleAboveWrapped(true); diff --git a/test/jalview/io/AnnotatedPDBFileInputTest.java b/test/jalview/io/AnnotatedPDBFileInputTest.java index 689bd59..1b62ce3 100644 --- a/test/jalview/io/AnnotatedPDBFileInputTest.java +++ b/test/jalview/io/AnnotatedPDBFileInputTest.java @@ -24,6 +24,15 @@ import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; +import java.io.File; +import java.util.List; + +import org.junit.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + import jalview.bin.Cache; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; @@ -32,19 +41,11 @@ import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.datamodel.features.SequenceFeatures; import jalview.gui.AlignFrame; +import jalview.gui.Desktop; import jalview.gui.JvOptionPane; import jalview.structure.StructureImportSettings; import jalview.structure.StructureImportSettings.StructureParser; -import java.io.File; -import java.util.List; - -import org.junit.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - public class AnnotatedPDBFileInputTest { @@ -207,8 +208,8 @@ public class AnnotatedPDBFileInputTest @AfterClass(alwaysRun = true) public static void tearDownAfterClass() throws Exception { - jalview.gui.Desktop.instance.closeAll_actionPerformed(null); - + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }) diff --git a/test/jalview/io/CrossRef2xmlTests.java b/test/jalview/io/CrossRef2xmlTests.java index 3ca6ed8..0189ef2 100644 --- a/test/jalview/io/CrossRef2xmlTests.java +++ b/test/jalview/io/CrossRef2xmlTests.java @@ -24,20 +24,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; -import jalview.analysis.CrossRef; -import jalview.api.AlignmentViewPanel; -import jalview.datamodel.AlignedCodonFrame; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.AlignmentTest; -import jalview.datamodel.SequenceI; -import jalview.gui.AlignFrame; -import jalview.gui.CrossRefAction; -import jalview.gui.Desktop; -import jalview.gui.JvOptionPane; -import jalview.gui.SequenceFetcher; -import jalview.project.Jalview2XML; -import jalview.util.DBRefUtils; - import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -51,6 +37,19 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import jalview.analysis.CrossRef; +import jalview.api.AlignmentViewPanel; +import jalview.datamodel.AlignedCodonFrame; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.AlignmentTest; +import jalview.datamodel.SequenceI; +import jalview.gui.AlignFrame; +import jalview.gui.CrossRefAction; +import jalview.gui.Desktop; +import jalview.gui.JvOptionPane; +import jalview.gui.SequenceFetcher; +import jalview.project.Jalview2XML; +import jalview.util.DBRefUtils; import junit.extensions.PA; @Test(singleThreaded = true) @@ -211,7 +210,8 @@ public class CrossRef2xmlTests extends Jalview2xmlBase } else { - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); // recover stored project af = new FileLoader(false).LoadFileWaitTillLoaded( savedProjects.get(first).toString(), DataSourceType.FILE); @@ -278,7 +278,8 @@ public class CrossRef2xmlTests extends Jalview2xmlBase } else { - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); pass3 = 0; // recover stored project File storedProject = savedProjects.get(nextxref); @@ -389,7 +390,8 @@ public class CrossRef2xmlTests extends Jalview2xmlBase } else { - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); // recover stored project File storedProject = savedProjects.get(nextnextxref); if (storedProject == null) @@ -416,7 +418,7 @@ public class CrossRef2xmlTests extends Jalview2xmlBase cra_views2.add(af2.getViewport().getAlignPanel()); cra_views2.add(((jalview.gui.AlignViewport) af2 .getViewport().getCodingComplement()) - .getAlignPanel()); + .getAlignPanel()); } else @@ -424,7 +426,7 @@ public class CrossRef2xmlTests extends Jalview2xmlBase // bottom view, then top cra_views2.add(((jalview.gui.AlignViewport) af2 .getViewport().getCodingComplement()) - .getAlignPanel()); + .getAlignPanel()); cra_views2.add(af2.getViewport().getAlignPanel()); } Assert.assertEquals(cra_views2.size(), 2); diff --git a/test/jalview/io/Jalview2xmlBase.java b/test/jalview/io/Jalview2xmlBase.java index dde23e6..a197340 100644 --- a/test/jalview/io/Jalview2xmlBase.java +++ b/test/jalview/io/Jalview2xmlBase.java @@ -20,6 +20,12 @@ */ package jalview.io; +import java.util.Date; + +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeTest; + import jalview.bin.Cache; import jalview.bin.Jalview; import jalview.datamodel.AlignmentAnnotation; @@ -27,12 +33,6 @@ import jalview.datamodel.SequenceI; import jalview.gui.Desktop; import jalview.gui.JvOptionPane; -import java.util.Date; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeTest; - public class Jalview2xmlBase { @@ -71,7 +71,8 @@ public class Jalview2xmlBase @AfterClass(alwaysRun = true) public static void tearDownAfterClass() throws Exception { - jalview.gui.Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); } @BeforeTest(alwaysRun = true) diff --git a/test/jalview/io/JalviewExportPropertiesTests.java b/test/jalview/io/JalviewExportPropertiesTests.java index 1d138c0..59c5986 100644 --- a/test/jalview/io/JalviewExportPropertiesTests.java +++ b/test/jalview/io/JalviewExportPropertiesTests.java @@ -22,14 +22,15 @@ package jalview.io; import static org.testng.AssertJUnit.assertTrue; -import jalview.datamodel.SequenceGroup; -import jalview.gui.AlignFrame; -import jalview.gui.JvOptionPane; - import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +import jalview.datamodel.SequenceGroup; +import jalview.gui.AlignFrame; +import jalview.gui.Desktop; +import jalview.gui.JvOptionPane; + /** * tests which verify that properties and preferences are correctly interpreted * when exporting/importing data @@ -64,7 +65,8 @@ public class JalviewExportPropertiesTests @AfterClass(alwaysRun = true) public static void tearDownAfterClass() throws Exception { - jalview.gui.Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); } diff --git a/test/jalview/project/Jalview2xmlTests.java b/test/jalview/project/Jalview2xmlTests.java index 510b21d..094e0ea 100644 --- a/test/jalview/project/Jalview2xmlTests.java +++ b/test/jalview/project/Jalview2xmlTests.java @@ -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)); } } - + } } diff --git a/test/jalview/renderer/seqfeatures/FeatureRendererTest.java b/test/jalview/renderer/seqfeatures/FeatureRendererTest.java index a3d0a7c..f7d8be5 100644 --- a/test/jalview/renderer/seqfeatures/FeatureRendererTest.java +++ b/test/jalview/renderer/seqfeatures/FeatureRendererTest.java @@ -27,6 +27,16 @@ import static org.testng.Assert.assertNull; import static org.testng.Assert.assertSame; import static org.testng.Assert.assertTrue; +import java.awt.Color; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + import jalview.analysis.GeneticCodes; import jalview.api.AlignViewportI; import jalview.api.FeatureColourI; @@ -46,17 +56,14 @@ import jalview.schemes.FeatureColour; import jalview.util.matcher.Condition; import jalview.viewmodel.seqfeatures.FeatureRendererModel.FeatureSettingsBean; -import java.awt.Color; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.testng.annotations.Test; - public class FeatureRendererTest { + @BeforeMethod(alwaysRun = true) + public void closeAll() + { + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); + } @Test(groups = "Functional") public void testFindAllFeatures() @@ -618,7 +625,7 @@ public class FeatureRendererTest { Jalview.main( new String[] - { "-nonews", "-props", "test/jalview/testProps.jvprops" }); + { "-nonews", "--props", "test/jalview/testProps.jvprops" }); // codons for MCWHSE String cdsSeq = ">cds\nATGtgtTGGcacTCAgaa"; diff --git a/test/jalview/schemes/ColourSchemesTest.java b/test/jalview/schemes/ColourSchemesTest.java index 58e272d..0184f12 100644 --- a/test/jalview/schemes/ColourSchemesTest.java +++ b/test/jalview/schemes/ColourSchemesTest.java @@ -25,6 +25,14 @@ import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertSame; import static org.testng.Assert.assertTrue; +import java.awt.Color; +import java.util.Iterator; +import java.util.Map; + +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + import jalview.api.AlignViewportI; import jalview.bin.Cache; import jalview.bin.Jalview; @@ -38,14 +46,6 @@ import jalview.io.DataSourceType; import jalview.io.FileLoader; import jalview.schemes.ClustalxColourScheme.ClustalColour; -import java.awt.Color; -import java.util.Iterator; -import java.util.Map; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - public class ColourSchemesTest { /* @@ -192,7 +192,8 @@ public class ColourSchemesTest @AfterClass(alwaysRun = true) public static void tearDownAfterClass() throws Exception { - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = "Functional") diff --git a/test/jalview/structure/StructureSelectionManagerTest.java b/test/jalview/structure/StructureSelectionManagerTest.java index ac8235d..624548f 100644 --- a/test/jalview/structure/StructureSelectionManagerTest.java +++ b/test/jalview/structure/StructureSelectionManagerTest.java @@ -204,7 +204,8 @@ public class StructureSelectionManagerTest extends Jalview2xmlBase { // for some reason 'BeforeMethod' (which should be inherited from // Jalview2XmlBase isn't always called)... - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); try { Thread.sleep(200); -- 1.7.10.2