+
+ @Test(groups = "Functional")
+ public void testMakeVisibleAnnotation_TruncateNegativeStart()
+ {
+ Annotation[] annots = annotsRange(8);
+ AlignmentAnnotation ann = new AlignmentAnnotation("label", "desc", annots);
+ HiddenColumns hc = new HiddenColumns();
+ ann.makeVisibleAnnotation(-5, 1, hc);
+ assertThat(ann.annotations,
+ matchesAnnotations(new Annotation(0), new Annotation(1)));
+ }
+
+ @Test(groups = "Functional")
+ public void testMakeVisibleAnnotation_TruncateNegativeStartAndEnd()
+ {
+ Annotation[] annots = annotsRange(8);
+ AlignmentAnnotation ann = new AlignmentAnnotation("label", "desc", annots);
+ HiddenColumns hc = new HiddenColumns();
+ ann.makeVisibleAnnotation(-5, -2, hc);
+ assertThat(ann.annotations, is(emptyArray()));
+ }
+
+ @Test(groups = "Functional")
+ public void testMakeVisibleAnnotation_TruncateEndBeyondSize()
+ {
+ Annotation[] annots = annotsRange(8);
+ AlignmentAnnotation ann = new AlignmentAnnotation("label", "desc", annots);
+ HiddenColumns hc = new HiddenColumns();
+ ann.makeVisibleAnnotation(6, 10, hc);
+ assertThat(ann.annotations, matchesAnnotations(new Annotation(6), new Annotation(7)));
+ }
+
+ @Test(groups = "Functional")
+ public void testMakeVisibleAnnotation_TruncateStartAndEndBeyondSize()
+ {
+ Annotation[] annots = annotsRange(4);
+ AlignmentAnnotation ann = new AlignmentAnnotation("label", "desc", annots);
+ HiddenColumns hc = new HiddenColumns();
+ ann.makeVisibleAnnotation(6, 10, hc);
+ assertThat(ann.annotations, is(emptyArray()));
+ }
+
+ static Annotation[] annotsRange(int stop)
+ {
+ Annotation[] annotations = new Annotation[stop];
+ for (int i = 0; i < stop; i++)
+ annotations[i] = new Annotation(i);
+ return annotations;
+ }