JAL-2781 report exactly which residues do not receive RESNUM annotation from associat...
authorJim Procter <jprocter@issues.jalview.org>
Tue, 13 Feb 2018 12:50:40 +0000 (12:50 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 13 Feb 2018 12:50:40 +0000 (12:50 +0000)
test/jalview/ws/PDBSequenceFetcherTest.java

index 78ab67e..ba90dd8 100644 (file)
@@ -35,6 +35,7 @@ import jalview.ws.seqfetcher.DbSourceProxy;
 import java.util.Arrays;
 import java.util.List;
 
+import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -145,12 +146,34 @@ public class PDBSequenceFetcherTest
                 sq.getAllPDBEntries().size() > 0);
         // FIXME: should test that all residues extracted as sequences from
         // chains in structure have a mapping to data in the structure
-
+        StringBuilder errors = new StringBuilder();
+        List<SequenceFeature> prev = null;
+        int lastp = -1;
         for (int rs = sq.getStart(); rs < sq.getStart()
                 + sq.getLength(); rs++)
         {
           List<SequenceFeature> sf = sq.findFeatures(rs, rs, "RESNUM");
-          assertEquals(sf.size(), 1);
+          if (sf.size() != 1)
+          {
+            errors.append(
+                    "Expected feature at " + rs + ": saw " + sf.size());
+            errors.append("\n");
+            if (prev != null)
+            {
+              errors.append("Last Feature was at " + lastp + ": "
+                      + prev.get(0).toString());
+              errors.append("\n");
+            }
+          }
+          else
+          {
+            prev = sf;
+            lastp = rs;
+          }
+        }
+        if (errors.length() > 0)
+        {
+          Assert.fail(errors.toString());
         }
       }
     }