From: Jim Procter Date: Tue, 22 Sep 2020 13:30:23 +0000 (+0100) Subject: JAL-3748 additional asserts to verify start/end after reconstructing sequence from... X-Git-Tag: Release_2_11_1_3~5^2~26 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9a9455154491b2eda742d399efb93eee029e22cd;p=jalview.git JAL-3748 additional asserts to verify start/end after reconstructing sequence from seqCigar --- diff --git a/test/jalview/datamodel/SeqCigarTest.java b/test/jalview/datamodel/SeqCigarTest.java index 89169d6..7ec06aa 100644 --- a/test/jalview/datamodel/SeqCigarTest.java +++ b/test/jalview/datamodel/SeqCigarTest.java @@ -20,6 +20,7 @@ */ package jalview.datamodel; +import static org.testng.Assert.assertTrue; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; @@ -94,13 +95,13 @@ public class SeqCigarTest assertEquals("Failed parseCigar", ex_cs_gapped, gen_sgapped.getCigarstring()); - testSeqRecovery(gen_sgapped, s_gapped); + assertTrue(testSeqRecovery(gen_sgapped, s_gapped,true)); /* * Test dataset resolution */ SeqCigar sub_gapped = new SeqCigar(s_subsequence_gapped); - testSeqRecovery(sub_gapped, s_subsequence_gapped); + assertTrue(testSeqRecovery(sub_gapped, s_subsequence_gapped,true)); /* * Test width functions @@ -187,7 +188,7 @@ public class SeqCigarTest assertEquals("Failed getCigarstring", ex_cs_gapped, cs_gapped); } - protected void testSeqRecovery(SeqCigar gen_sgapped, SequenceI s_gapped) + protected boolean testSeqRecovery(SeqCigar gen_sgapped, SequenceI s_gapped,boolean startEndCheck) { // this is non-rigorous - start and end recovery is not tested. SequenceI gen_sgapped_s = gen_sgapped.getSeq('-'); @@ -201,7 +202,14 @@ public class SeqCigarTest System.err.println("Couldn't reconstruct sequence.\n" + gen_sgapped_s.getSequenceAsString() + "\n" + s_gapped.getSequenceAsString()); + return false; } + if (startEndCheck) + { + assertEquals("Start not conserved in reconstructed sequence",s_gapped.getStart(),gen_sgapped_s.getStart()); + assertEquals("End not conserved in reconstructed sequence",s_gapped.getEnd(),gen_sgapped_s.getEnd()); + } + return true; } }