From 3f188b6aeeabe830a566d8c58e9566a5deb36129 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 26 Jun 2019 12:08:49 +0100 Subject: [PATCH] JAL-3330 JAL-3332 relocate and simplify BeforeClass/BeforeTest to avoid ambiguity in setup --- test/jalview/gui/AlignFrameTest.java | 94 +++++++++++++++++----------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/test/jalview/gui/AlignFrameTest.java b/test/jalview/gui/AlignFrameTest.java index 454ff61..3e82547 100644 --- a/test/jalview/gui/AlignFrameTest.java +++ b/test/jalview/gui/AlignFrameTest.java @@ -62,7 +62,53 @@ public class AlignFrameTest AlignFrame af; @BeforeClass(alwaysRun = true) - public void setUpJvOptionPane() + public static void setUpBeforeClass() throws Exception + { + setUpJvOptionPane(); + /* + * 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); + } + + /** + * configure (read-only) properties for test to ensure Consensus is computed for + * colour Above PID testing + */ + @BeforeMethod(alwaysRun = true) + public void setUp() + { + Cache.loadProperties("test/jalview/io/testProps.jvprops"); + Cache.applicationProperties.setProperty("SHOW_IDENTITY", + Boolean.TRUE.toString()); + af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa", + DataSourceType.FILE); + + /* + * wait for Consensus thread to complete + */ + synchronized (this) + { + while (af.getViewport().getConsensusSeq() == null) + { + try + { + wait(50); + } catch (InterruptedException e) + { + } + } + } + } + + public static void setUpJvOptionPane() { JvOptionPane.setInteractiveMode(false); JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); @@ -151,52 +197,6 @@ public class AlignFrameTest assertEquals(next[1], 8); } - @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); - } - - /** - * configure (read-only) properties for test to ensure Consensus is computed - * for colour Above PID testing - */ - @BeforeMethod(alwaysRun = true) - public void setUp() - { - Cache.loadProperties("test/jalview/io/testProps.jvprops"); - Cache.applicationProperties.setProperty("SHOW_IDENTITY", - Boolean.TRUE.toString()); - af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa", - DataSourceType.FILE); - - /* - * wait for Consensus thread to complete - */ - synchronized (this) - { - while (af.getViewport().getConsensusSeq() == null) - { - try - { - wait(50); - } catch (InterruptedException e) - { - } - } - } - } - /** * Test that changing background (alignment) colour scheme *