From d5f22defdce0bf4d162f976027cdbf6c2c43d036 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 20 Oct 2014 11:20:27 +0100 Subject: [PATCH] JAL-674 test for duplicate alignment annotation rows on aligment --- test/jalview/io/AnnotatedPDBFileInputTest.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/jalview/io/AnnotatedPDBFileInputTest.java b/test/jalview/io/AnnotatedPDBFileInputTest.java index a6d09cae..451f4fd 100644 --- a/test/jalview/io/AnnotatedPDBFileInputTest.java +++ b/test/jalview/io/AnnotatedPDBFileInputTest.java @@ -1,5 +1,6 @@ package jalview.io; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import jalview.datamodel.AlignmentAnnotation; @@ -24,6 +25,26 @@ public class AnnotatedPDBFileInputTest } @Test + public void checkNoDuplicates() + { + // not strictly a requirement, but strange things may happen if multiple + // instances of the same annotation are placed in the alignment annotation + // vector + assertNotNull(al.getAlignmentAnnotation()); + // verify that all sequence annotation is doubly referenced + AlignmentAnnotation[] avec = al.getAlignmentAnnotation(); + for (int p = 0; p < avec.length; p++) + { + for (int q = p + 1; q < avec.length; q++) + { + assertNotEquals( + "Found a duplicate annotation row " + avec[p].label, + avec[p], avec[q]); + } + } + } + + @Test public void checkAnnotationWiring() { assertTrue(al.getAlignmentAnnotation() != null); -- 1.7.10.2