JAL-3438 spotless for 2.11.2.0
[jalview.git] / test / jalview / analysis / TestAlignSeq.java
index 3c84189..5134511 100644 (file)
@@ -26,9 +26,11 @@ import static org.testng.AssertJUnit.assertNull;
 import jalview.datamodel.Mapping;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceI;
+import jalview.gui.JvOptionPane;
 
 import java.io.PrintStream;
 
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -41,12 +43,19 @@ import org.testng.annotations.Test;
 public class TestAlignSeq
 {
 
+  @BeforeClass(alwaysRun = true)
+  public void setUpJvOptionPane()
+  {
+    JvOptionPane.setInteractiveMode(false);
+    JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+  }
+
   SequenceI s1, s2, s3;
 
   /**
    * @throws java.lang.Exception
    */
- @BeforeMethod(alwaysRun = true)
+  @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
   {
     s1 = new Sequence("Seq1", "ASDFAQQQRRRSSS");
@@ -55,18 +64,17 @@ public class TestAlignSeq
     s2 = new Sequence("Seq2", "ASDFA");
     s2.setStart(5);
     s2.setEnd(9);
-    s3 = new Sequence("Seq1", "SDFAQQQSSS");
+    s3 = new Sequence("Seq3", "SDFAQQQSSS");
 
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   /**
    * simple test that mapping from alignment corresponds identical positions.
    */
   public void testGetMappingForS1()
   {
-    AlignSeq as = AlignSeq
-            .doGlobalNWAlignment(s1, s2, AlignSeq.PEP);
+    AlignSeq as = AlignSeq.doGlobalNWAlignment(s1, s2, AlignSeq.PEP);
     System.out.println("s1: " + as.getAStr1());
     System.out.println("s2: " + as.getAStr2());
 
@@ -86,7 +94,7 @@ public class TestAlignSeq
     }
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testExtractGaps()
   {
     assertNull(AlignSeq.extractGaps(null, null));
@@ -96,7 +104,7 @@ public class TestAlignSeq
     assertEquals("ABCD", AlignSeq.extractGaps(" .-", ". -A-B.C D."));
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testPrintAlignment()
   {
     AlignSeq as = AlignSeq.doGlobalNWAlignment(s1, s3, AlignSeq.PEP);
@@ -117,10 +125,9 @@ public class TestAlignSeq
     };
 
     as.printAlignment(ps);
-    String expected = "Score = 320\nLength of alignment = 10\nSequence Seq1 :  3 - 18 (Sequence length = 14)\nSequence Seq1 :  1 - 10 (Sequence length = 10)\n\n"
-            + "Seq1 SDFAQQQRRR\n"
-            + "     |||||||   \n"
-            + "Seq1 SDFAQQQSSS\n\n" + "Percentage ID = 70.00\n\n";
+    String expected = "Score = 320.0\nLength of alignment = 10\nSequence Seq1/4-13 (Sequence length = 14)\nSequence Seq3/1-10 (Sequence length = 10)\n\n"
+            + "Seq1/4-13 SDFAQQQRRR\n" + "          |||||||   \n"
+            + "Seq3/1-10 SDFAQQQSSS\n\n" + "Percentage ID = 70.00\n\n";
     assertEquals(expected, baos.toString());
   }
 }