From: Jim Procter Date: Fri, 26 Aug 2016 12:22:56 +0000 (+0100) Subject: JAL-2154 catch and report a failures when xrefed project didn’t seem to have associat... X-Git-Tag: Release_2_10_0~47^2~4^2~43^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=cc46e091f5da739ae8793f94ecafdc6d4a3ac2c0;p=jalview.git JAL-2154 catch and report a failures when xrefed project didn’t seem to have associated file (possibly due to failed ref retrieval) --- diff --git a/test/jalview/io/CrossRef2xmlTests.java b/test/jalview/io/CrossRef2xmlTests.java index 65c0d2b..67626c8 100644 --- a/test/jalview/io/CrossRef2xmlTests.java +++ b/test/jalview/io/CrossRef2xmlTests.java @@ -53,6 +53,8 @@ public class CrossRef2xmlTests extends Jalview2xmlBase public void testRetrieveAndShowCrossref() throws Exception { List failedXrefMenuItems = new ArrayList(); + List failedProjectRecoveries = new ArrayList(); + // for every set of db queries // retrieve db query // verify presence of expected xrefs @@ -175,6 +177,15 @@ public class CrossRef2xmlTests extends Jalview2xmlBase Desktop.instance.closeAll_actionPerformed(null); pass3 = 0; // recover stored project + File storedProject = savedProjects.get(nextxref); + if (storedProject == null) + { + failedProjectRecoveries.add("Failed to store a view for '" + + nextxref + "'"); + continue; + } + + // recover stored project AlignFrame af2 = new FileLoader(false) .LoadFileWaitTillLoaded(savedProjects.get(nextxref) .toString(), FormatAdapter.FILE); @@ -273,6 +284,14 @@ public class CrossRef2xmlTests extends Jalview2xmlBase { Desktop.instance.closeAll_actionPerformed(null); // recover stored project + File storedProject = savedProjects.get(nextnextxref); + if (storedProject == null) + { + failedProjectRecoveries + .add("Failed to store a view for '" + + nextnextxref + "'"); + continue; + } AlignFrame af2 = new FileLoader(false) .LoadFileWaitTillLoaded( savedProjects.get(nextnextxref) @@ -359,13 +378,22 @@ public class CrossRef2xmlTests extends Jalview2xmlBase } if (failedXrefMenuItems.size() > 0) { - StringBuilder sb = new StringBuilder(); for (String s : failedXrefMenuItems) { - sb.append(s + "\n"); + System.err.println(s); } Assert.fail("Faulty xref menu (" + failedXrefMenuItems.size() - + " counts)\n" + sb.toString()); + + " counts)"); + } + if (failedProjectRecoveries.size() > 0) + { + + for (String s : failedProjectRecoveries) + { + System.err.println(s); + } + Assert.fail("Didn't recover projects for some retrievals (did they retrieve ?) (" + + failedProjectRecoveries.size() + " counts)"); } }