X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fdatamodel%2FSequenceTest.java;h=eb75645dbef9c89d06f96b57e619593e34b5e598;hb=ca47e4d0e1176893b414fba3fbe8a308e24cc52e;hp=6d071130c23182cb703dcbad0734ee6ed6b3074b;hpb=bded98c37a83dcd79a8445e4272fb83fc28a26c5;p=jalview.git diff --git a/test/jalview/datamodel/SequenceTest.java b/test/jalview/datamodel/SequenceTest.java index 6d07113..eb75645 100644 --- a/test/jalview/datamodel/SequenceTest.java +++ b/test/jalview/datamodel/SequenceTest.java @@ -192,6 +192,35 @@ public class SequenceTest assertTrue(seq.getAlignmentAnnotations(null, null).isEmpty()); } + + @Test(groups = { "Functional" }) + public void testGetAlignmentAnnotations_forCalcIdLabelAndDescription() + { + addAnnotation("label1", "desc1", "calcId1", 1f); + AlignmentAnnotation ann2 = addAnnotation("label2", "desc2", "calcId2", + 1f); + addAnnotation("label2", "desc3", "calcId3", 1f); + AlignmentAnnotation ann4 = addAnnotation("label2", "desc3", "calcId2", + 1f); + addAnnotation("label5", "desc3", null, 1f); + addAnnotation(null, "desc3", "calcId3", 1f); + + List anns = seq.getAlignmentAnnotations("calcId2", + "label2", "desc3"); + assertEquals(1, anns.size()); + assertSame(ann4, anns.get(0)); + /** + * null matching should fail + */ + assertTrue(seq.getAlignmentAnnotations("calcId3", "label2",null).isEmpty()); + + assertTrue(seq.getAlignmentAnnotations("calcId2", "label3",null).isEmpty()); + assertTrue(seq.getAlignmentAnnotations("calcId3", "label5",null).isEmpty()); + assertTrue(seq.getAlignmentAnnotations("calcId2", null,null).isEmpty()); + assertTrue(seq.getAlignmentAnnotations(null, "label3",null).isEmpty()); + assertTrue(seq.getAlignmentAnnotations(null, null,null).isEmpty()); + } + /** * Tests for addAlignmentAnnotation. Note this method has the side-effect of * setting the sequenceRef on the annotation. Adding the same annotation twice