5 import org.testng.Assert;
6 import org.testng.annotations.AfterMethod;
7 import org.testng.annotations.BeforeClass;
8 import org.testng.annotations.DataProvider;
9 import org.testng.annotations.Test;
11 import jalview.gui.AlignFrame;
12 import jalview.gui.Desktop;
13 import jalview.gui.JvOptionPane;
15 @Test(singleThreaded = true)
16 public class CommandsTest
18 @BeforeClass(alwaysRun = true)
19 public static void setUpBeforeClass() throws Exception
21 Cache.loadProperties("test/jalview/gui/quitProps.jvprops");
22 Date oneHourFromNow = new Date(
23 System.currentTimeMillis() + 3600 * 1000);
24 Cache.setDateProperty("JALVIEW_NEWS_RSS_LASTMODIFIED", oneHourFromNow);
27 @BeforeClass(alwaysRun = true)
28 public void setUpJvOptionPane()
30 JvOptionPane.setInteractiveMode(false);
31 JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
34 @AfterMethod(alwaysRun = true)
35 public void tearDown()
37 Desktop.instance.closeAll_actionPerformed(null);
40 @Test(groups = "Functional", dataProvider = "cmdLines")
41 public void commandsOpenTest(String cmdLine, String sequence)
43 String[] args = cmdLine.split("\\s+");
45 ArgParser argparser = new ArgParser(args);
46 boolean commandsSuccess = Commands.processArgs(argparser, false);
47 Assert.assertTrue(commandsSuccess, "Overall commandsSuccess is false");
51 AlignFrame[] afs = Desktop.getAlignFrames();
52 boolean found = false;
53 ALIGNFRAME: for (AlignFrame af : afs)
55 for (String name : af.getViewport().getAlignment()
58 if (sequence.equals(name))
65 Assert.assertTrue(found, "Sequence '" + sequence
66 + "' was not found in opened alignment files: " + cmdLine);
70 @DataProvider(name = "cmdLines")
71 public Object[][] cmdLines()
73 return new Object[][] { { "--open=examples/uniref50.fa", "FER1_SPIOL" },
74 { "--argfile=test/jalview/bin/argparser/argfile0.txt", null } };