+ @Test(groups = { "Functional" })
+ public void testExtractGaps()
+ {
+ assertNull(AlignSeq.extractGaps(null, null));
+ assertNull(AlignSeq.extractGaps(". -", null));
+ assertNull(AlignSeq.extractGaps(null, "AB-C"));
+
+ assertEquals("ABCD", AlignSeq.extractGaps(" .-", ". -A-B.C D."));
+ }
+
+ @Test(groups = { "Functional" })
+ public void testPrintAlignment()
+ {
+ AlignSeq as = AlignSeq.doGlobalNWAlignment(s1, s3, AlignSeq.PEP);
+ final StringBuilder baos = new StringBuilder();
+ PrintStream ps = new PrintStream(System.out)
+ {
+ @Override
+ public void print(String x)
+ {
+ baos.append(x);
+ }
+
+ @Override
+ public void println()
+ {
+ baos.append("\n");
+ }
+ };
+
+ as.printAlignment(ps);
+ String expected = "Score = 320.0\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";
+ assertEquals(expected, baos.toString());
+ }