From: gmungoc Date: Tue, 27 Jun 2017 20:16:00 +0000 (+0100) Subject: JAL-2541 more useful assert message X-Git-Tag: Release_2_11_1_0~98^2~23^2~10 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a0f5d824a990f6ca892ab90cebd783e074b96696;p=jalview.git JAL-2541 more useful assert message Conflicts: test/jalview/commands/EditCommandTest.java --- diff --git a/test/jalview/commands/EditCommandTest.java b/test/jalview/commands/EditCommandTest.java index 326104a..ac47555 100644 --- a/test/jalview/commands/EditCommandTest.java +++ b/test/jalview/commands/EditCommandTest.java @@ -796,13 +796,36 @@ public class EditCommandTest * undo ready for next cut */ testee.undoCommand(new AlignmentI[] { alignment }); - int size = seq0.getSequenceFeatures().size(); - assertEquals(func(5), size); + sfs = seq0.getSequenceFeatures(); + assertEquals("After undo of " + msg, func(5), sfs.size()); + verifyUndo(from, to, sfs); } } } /** + * Check that after Undo, every feature has start/end that match its original + * "start" and "end" properties + * + * @param from + * @param to + * @param sfs + */ + protected void verifyUndo(int from, int to, List sfs) + { + for (SequenceFeature sf : sfs) + { + final int oldFrom = ((Integer) sf.getValue("from")).intValue(); + final int oldTo = ((Integer) sf.getValue("to")).intValue(); + String msg = String.format( + "Undo cut of [%d-%d], feature at [%d-%d] ", from + 1, to + 1, + oldFrom, oldTo); + assertEquals(msg + "start", oldFrom, sf.getBegin()); + assertEquals(msg + "end", oldTo, sf.getEnd()); + } + } + + /** * Helper method to check a feature has been correctly relocated after a cut * * @param sf