From 53ef0b8b1f5cad886db96520528e367aadec2712 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 29 Jan 2018 14:04:34 +0000 Subject: [PATCH] JAL-1270 testPadGaps() added --- test/jalview/datamodel/AlignmentTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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()); + } } -- 1.7.10.2