JAL-2154 report any db fetch failures as a fail at end
authorJim Procter <jprocter@issues.jalview.org>
Fri, 26 Aug 2016 12:43:06 +0000 (13:43 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Fri, 26 Aug 2016 12:43:06 +0000 (13:43 +0100)
test/jalview/io/CrossRef2xmlTests.java

index fc59e1f..838aa7a 100644 (file)
@@ -52,6 +52,8 @@ public class CrossRef2xmlTests extends Jalview2xmlBase
   @Test(groups = { "Operational" }, enabled = true)
   public void testRetrieveAndShowCrossref() throws Exception
   {
+
+    List<String> failedDBRetr = new ArrayList<String>();
     List<String> failedXrefMenuItems = new ArrayList<String>();
     List<String> failedProjectRecoveries = new ArrayList<String>();
 
@@ -97,11 +99,15 @@ public class CrossRef2xmlTests extends Jalview2xmlBase
         {
           // retrieve dbref
 
+          List<AlignFrame> afs = jalview.gui.SequenceFetcher.fetchAndShow(
+                  did[0], did[1]);
+          if (afs.size() == 0)
+          {
+            failedDBRetr.add("Didn't retrieve " + first);
+            break;
+          }
           keyseq.add(first);
-
-          af = jalview.gui.SequenceFetcher.fetchAndShow(did[0], did[1])
-                  .get(0);
-          Assert.assertTrue(af != null, "Didn't retrieve " + first);
+          af = afs.get(0);
 
           // verify references for retrieved data
           AlignmentTest.assertAlignmentDatasetRefs(af.getViewport()
@@ -399,6 +405,15 @@ public class CrossRef2xmlTests extends Jalview2xmlBase
       Assert.fail("Didn't recover projects for some retrievals (did they retrieve ?) ("
               + failedProjectRecoveries.size() + " counts)");
     }
+    if (failedDBRetr.size() > 0)
+    {
+      for (String s : failedProjectRecoveries)
+      {
+        System.err.println(s);
+      }
+      Assert.fail("Didn't retrieve some db refs for checking cross-refs ("
+              + failedDBRetr.size() + " counts)");
+    }
   }
 
   private void assertProtein(AlignmentViewPanel alignmentViewPanel,