From: gmungoc Date: Mon, 29 Jan 2018 14:04:34 +0000 (+0000) Subject: JAL-1270 testPadGaps() added X-Git-Tag: Release_2_10_4~55^2~1^2~17^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=53ef0b8b1f5cad886db96520528e367aadec2712;p=jalview.git JAL-1270 testPadGaps() added --- diff --git a/test/jalview/datamodel/AlignmentTest.java b/test/jalview/datamodel/AlignmentTest.java index 2fed815..ddba949 100644 --- a/test/jalview/datamodel/AlignmentTest.java +++ b/test/jalview/datamodel/AlignmentTest.java @@ -1437,4 +1437,20 @@ public class AlignmentTest assertTrue(Comparison.isGap(al.getSequenceAt(1).getSequence()[6])); assertFalse(Comparison.isGap(al.getSequenceAt(1).getSequence()[7])); } + + @Test(groups = { "Functional" }) + public void testPadGaps() + { + SequenceI seq1 = new Sequence("seq1", "ABCDEF--"); + SequenceI seq2 = new Sequence("seq2", "-JKLMNO--"); + SequenceI seq3 = new Sequence("seq2", "-PQR"); + AlignmentI a = new Alignment(new SequenceI[] { seq1, seq2, seq3 }); + a.setGapCharacter('.'); // this replaces existing gaps + assertEquals("ABCDEF..", seq1.getSequenceAsString()); + a.padGaps(); + // trailing gaps are pruned, short sequences padded with gap character + assertEquals("ABCDEF.", seq1.getSequenceAsString()); + assertEquals(".JKLMNO", seq2.getSequenceAsString()); + assertEquals(".PQR...", seq3.getSequenceAsString()); + } }