X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fdatamodel%2FAlignmentTest.java;h=7ad9436c858f8ef2fed092007d4d26a6550a73d8;hb=a4da7308cd43dcd4bddd773453007c916735d68a;hp=379a9c5fe8269a7e5246bbca4abd07a1f2da7b7d;hpb=24883be7e7402b172bf83f438c807e58e8a10101;p=jalview.git diff --git a/test/jalview/datamodel/AlignmentTest.java b/test/jalview/datamodel/AlignmentTest.java index 379a9c5..7ad9436 100644 --- a/test/jalview/datamodel/AlignmentTest.java +++ b/test/jalview/datamodel/AlignmentTest.java @@ -419,7 +419,143 @@ public class AlignmentTest al.getDataset().addSequence(sqanotherout); assertVerifyAlignment(al, false, "verify should have failed when a sequence was added twice to the dataset"); + al.getDataset().deleteSequence(sqanotherout); + assertVerifyAlignment(al, true, + "verify should have passed after duplicate entry for sequence was removed"); + } + + /** + * checks that the sequence data for an alignment's dataset is non-redundant. + * Fails if there are sequences with same id, sequence, start, and. + */ + + public static void assertDatasetIsNormalised(AlignmentI al) + { + assertDatasetIsNormalised(al, null); + } + + /** + * checks that the sequence data for an alignment's dataset is non-redundant. + * Fails if there are sequences with same id, sequence, start, and. + * + * @param al + * - alignment to verify + * @param message + * - null or message prepended to exception message. + */ + public static void assertDatasetIsNormalised(AlignmentI al, String message) + { + if (al.getDataset()!=null) + { + assertDatasetIsNormalised(al.getDataset(), message); + return; + } + /* + * look for pairs of sequences with same ID, start, end, and sequence + */ + List seqSet = al.getSequences(); + for (int p=0;p