From cc46e091f5da739ae8793f94ecafdc6d4a3ac2c0 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 26 Aug 2016 13:22:56 +0100 Subject: [PATCH] =?utf8?q?JAL-2154=20catch=20and=20report=20a=20failures=20w?= =?utf8?q?hen=20xrefed=20project=20didn=E2=80=99t=20seem=20to=20have=20assoc?= =?utf8?q?iated=20file=20(possibly=20due=20to=20failed=20ref=20retrieval)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- test/jalview/io/CrossRef2xmlTests.java | 34 +++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) 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)"); } } -- 1.7.10.2