JAL-2154 Defer failing cross-ref combinations that didn’t result in a new alignment...
authorJim Procter <jprocter@issues.jalview.org>
Fri, 26 Aug 2016 09:51:23 +0000 (10:51 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Fri, 26 Aug 2016 09:51:23 +0000 (10:51 +0100)
test/jalview/io/CrossRef2xmlTests.java

index 24074d0..65c0d2b 100644 (file)
@@ -52,6 +52,7 @@ public class CrossRef2xmlTests extends Jalview2xmlBase
   @Test(groups = { "Operational" }, enabled = true)
   public void testRetrieveAndShowCrossref() throws Exception
   {
+    List<String> failedXrefMenuItems = new ArrayList<String>();
     // for every set of db queries
     // retrieve db query
     // verify presence of expected xrefs
@@ -155,8 +156,12 @@ public class CrossRef2xmlTests extends Jalview2xmlBase
             { // retrieve and show cross-refs in this thread
               cra = new CrossRefAction(af, seqs, dna, db);
               cra.run();
-              Assert.assertTrue(cra.getXrefViews().size() > 0,
-                      "No crossrefs retrieved for " + db);
+              if (cra.getXrefViews().size() == 0)
+              {
+                failedXrefMenuItems.add("No crossrefs retrieved for "
+                        + first + " -> " + db);
+                continue;
+              }
               cra_views = cra.getXrefViews();
               assertNucleotide(cra_views.get(0),
                       "Nucleotide panel included proteins for " + first
@@ -245,11 +250,14 @@ public class CrossRef2xmlTests extends Jalview2xmlBase
                     cra = new CrossRefAction(nextaf, xrseqs, avp
                             .getAlignViewport().isNucleotide(), xrefdb);
                     cra.run();
-                    Assert.assertTrue(
-                            cra.getXrefViews().size() > 0,
-                            "No crossrefs found for '" + nextnextxref
-                                    + "' to " + xrefdb + " via '"
-                                    + nextaf.getTitle() + "'");
+                    if (cra.getXrefViews().size() == 0)
+                    {
+                      failedXrefMenuItems
+                              .add("No crossrefs retrieved for '"
+                              + nextxref + "' to " + xrefdb + " via '"
+                              + nextaf.getTitle() + "'");
+                      continue;
+                    }
                     cra_views2 = cra.getXrefViews();
                     assertNucleotide(cra_views2.get(0),
                             "Nucleotide panel included proteins for '"
@@ -349,6 +357,16 @@ public class CrossRef2xmlTests extends Jalview2xmlBase
         }
       } while (pass3 < 2);
     }
+    if (failedXrefMenuItems.size() > 0)
+    {
+      StringBuilder sb = new StringBuilder();
+      for (String s : failedXrefMenuItems)
+      {
+        sb.append(s + "\n");
+      }
+      Assert.fail("Faulty xref menu (" + failedXrefMenuItems.size()
+              + " counts)\n" + sb.toString());
+    }
   }
 
   private void assertProtein(AlignmentViewPanel alignmentViewPanel,