JAL-2890 added test
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Thu, 1 Feb 2018 19:26:50 +0000 (19:26 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Thu, 1 Feb 2018 19:26:50 +0000 (19:26 +0000)
test/jalview/ext/cipres/CipresJobTest.java [new file with mode: 0644]

diff --git a/test/jalview/ext/cipres/CipresJobTest.java b/test/jalview/ext/cipres/CipresJobTest.java
new file mode 100644 (file)
index 0000000..a1cd2df
--- /dev/null
@@ -0,0 +1,70 @@
+package jalview.ext.cipres;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import jalview.gui.JvOptionPane;
+
+import java.util.Arrays;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class CipresJobTest
+{
+  @BeforeClass(
+    alwaysRun = true
+  )
+  public void setUpJvOptionPane()
+  {
+    JvOptionPane.setInteractiveMode(false);
+    JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+  }
+
+  @Test(
+    groups = "Functional"
+  )
+  public void testSettingJobParameters()
+  {
+    CipresJob testJob = new CipresJob("examples/plantfdx.fa");
+    testJob.addToolParameters("runtime_", Arrays.asList("0.3"));
+    testJob.addInputParameter("test", "hoi");
+    testJob.addMetadata("hennepin", "crawler");
+    assertFalse(testJob.areParamsValidated());
+
+    testJob.clearAllParameters();
+    assertNull(testJob.getvParams().get("runtime_"));
+
+
+  }
+
+  @Test(
+    groups =
+    { "External" }
+  )
+  public void testValidatingParameters()
+  {
+    CipresJob testJob = new CipresJob("examples/plantfdx.fa", "CLUSTALW");
+    testJob.addToolParameters("runtime_", Arrays.asList("0.2"));
+    testJob.addMetadata("clientJobId", "101");
+    testJob.validateJobParams();
+    assertTrue(testJob.areParamsValidated());
+
+  }
+
+  @Test(
+    groups =
+    { "External" }
+  )
+  public void testJobSubmission()
+  {
+    CipresJob testJob = new CipresJob("examples/plantfdx.fa", "CLUSTALW");
+    testJob.addToolParameters("runtime_", Arrays.asList("0.2"));
+    testJob.addMetadata("clientJobId", "102");
+    testJob.addMetadata("statusEmail", "false");
+    testJob.addMetadata("clientJobName", "test_job");
+    testJob.submitJob();
+
+  }
+}