JAL-2154 patch verifyAlignment so it fails for duplicate entries for same SequenceI...
authorJim Procter <jprocter@issues.jalview.org>
Mon, 22 Aug 2016 10:54:02 +0000 (11:54 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 22 Aug 2016 10:54:02 +0000 (11:54 +0100)
test/jalview/datamodel/AlignmentTest.java

index dbecc20..379a9c5 100644 (file)
@@ -178,9 +178,11 @@ public class AlignmentTest
     }
     else
     {
+      int dsp = -1;
       // verify all dataset sequences
       for (SequenceI seqds : alignment.getSequences())
       {
+        dsp++;
         if (seqds.getDatasetSequence() != null)
         {
           if (raiseAssert)
@@ -189,6 +191,18 @@ public class AlignmentTest
           }
           return false;
         }
+        int foundp = alignment.findIndex(seqds);
+        if (foundp != dsp)
+        {
+          if (raiseAssert)
+          {
+            Assert.fail(message
+                    + " Dataset sequence array contains a reference at "
+                    + dsp + " to a sequence first seen at " + foundp + " ("
+                    + seqds.toString() + ")");
+          }
+          return false;
+        }
         if (seqds.getDBRefs() != null)
         {
           for (DBRefEntry dbr : seqds.getDBRefs())