5 import org.testng.Assert;
6 import org.testng.annotations.BeforeClass;
7 import org.testng.annotations.DataProvider;
8 import org.testng.annotations.Test;
10 import jalview.gui.AlignFrame;
11 import jalview.gui.Desktop;
12 import jalview.gui.JvOptionPane;
14 @Test(singleThreaded = true)
15 public class CommandsTest
17 @BeforeClass(alwaysRun = true)
18 public static void setUpBeforeClass() throws Exception
20 Cache.loadProperties("test/jalview/gui/quitProps.jvprops");
21 Date oneHourFromNow = new Date(
22 System.currentTimeMillis() + 3600 * 1000);
23 Cache.setDateProperty("JALVIEW_NEWS_RSS_LASTMODIFIED", oneHourFromNow);
26 @BeforeClass(alwaysRun = true)
27 public void setUpJvOptionPane()
29 JvOptionPane.setInteractiveMode(false);
30 JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
33 @Test(groups = "Functional", dataProvider = "cmdLines")
34 public void commandsOpenTest(String cmdLine, String sequence)
36 String[] args = cmdLine.split("\\s+");
38 ArgParser argparser = new ArgParser(args);
39 boolean commandsSuccess = Commands.processArgs(argparser, false);
40 Assert.assertTrue(commandsSuccess, "Overall commandsSuccess is false");
44 AlignFrame[] afs = Desktop.getAlignFrames();
45 boolean found = false;
46 ALIGNFRAME: for (AlignFrame af : afs)
48 for (String name : af.getViewport().getAlignment()
51 if (sequence.equals(name))
58 Assert.assertTrue(found, "Sequence '" + sequence
59 + "' was not found in opened alignment files: " + cmdLine);
63 @DataProvider(name = "cmdLines")
64 public Object[][] cmdLines()
66 return new Object[][] { { "--open=examples/uniref50.fa", "FER1_SPIOL" },
67 { "--argfile=test/jalview/bin/argparser/argfile0.txt", null } };