From 11e0cf26083bf4aa22333b8ec02c5f1eed80a1e5 Mon Sep 17 00:00:00 2001 From: pvtroshin Date: Thu, 22 Jul 2010 12:22:47 +0000 Subject: [PATCH] getStatistics test method fixed git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@2650 e3abac25-378b-4346-85de-24260fe3988d --- WEB-INF/lib/compbio-util-1.2.jar | Bin 16533 -> 16690 bytes testsrc/compbio/runner/disorder/JronnTester.java | 504 +++++++++++----------- 2 files changed, 257 insertions(+), 247 deletions(-) diff --git a/WEB-INF/lib/compbio-util-1.2.jar b/WEB-INF/lib/compbio-util-1.2.jar index a69d62768973a8921d0307741e3ef6c9ee8c4679..a8e20becf80845baf64bc25e8de50eb58d308a2c 100644 GIT binary patch delta 3458 zcmZ9PXFMC++sB0(HA}^A&DyFeK}cw+y+v(WYVX;gC1xt2F``x@s4A*Pr6tzCx7Ml{ zw@uC1rS_(+|6TX@ueHKP9NOy>$386BU&SH%^FK9*GjZ zBP2}ezGOx;)FWA5x~CVzVXSE<#ABE6b<>qdn$SmhT&=0IuphRXv@7`-XVGsVS0~U| zG-xmqH(KmnQD^sL_9&|U+tJH>7D}V=GVT;&~0ID8-?dFE6EVerXi56SB z%_?u_ouTvE7ImrNK|RUx-KDzs1-Qc=e9qRMS7^Yeja4(e>bwt)mAL;Dh-3>7vPjF{ zos*I$9M1blb3J;Xuu0tc1P|}aFqt0%CzhuQ;U)f+rf@B{C_x+|%miWYX1YLntX?a(B{vUJccb z*`PfG53n&1Np+;Hv}~W5Ay<^MFkHdA{vOFxQzTFtT`l9D=;96~w2o)eFW3ruw+2EV zDp&#R=Pjn@9=RIOT}@{QdEc7NW@r9Wn${Zyh;keW^m5X#ly_$dwcV-d3VIYE=tkrf zMGt4Ju7|{AYWH|{ZI)UVA~G{y`{{J6sPtAP-MeA(yr)DHcpj2FUt6Ec5Q;|ZnmxD%1WY1dr*X} z(EOXm#uSaC&(n5&lfS47?xBY?vPH%)2Ro)DJij{F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Q8jSs*-9b2T+Bm$pVU?WC+ zr|(QT5w-!e`gTELT~2+alR9)lEzE3@jjEBhmoh~qr7Q#yH3hnNoVuf{uRm)Oe+bJg z#r+C{fd}7vj!NrVTKL5!8sur~Wy$@No<)>A6E_>o_nN|dtq;Z-ObE!-#YCi1oPzaH z*^IiNjB3KyQ}BU~ME+-TQ~vLr3KbrNt7|%|p1S!P1&Rj&JM)q{fb&C`j>RvJ2q)Jh zmlfoq1xjPJq@EM$FVu6Biffm`4w6=ZwA527Wk{#xCpliM9w zYf|w`!sDVY%WEgB0G;40y3AshMkojJ`9{{Li8(z9PhjYhlN7I~YS~$N` zELkJHjP8!qO4YWUcovS*8Z{XV#_Z8saIR^`Nm>1vRn^lKU9z|5B4f0SG4&+1;^$?$ z9N+T{W#CxP>}f8qs#ZzanYu^ zx~S_Ka+C?`eHoFg&bbc1`}6o(sk@0P%I(E26OmJVjrnM(RHQ#r-uIJ+nuRoNe&|4E zu}~&;DRAySQn!eVxovkh3E0%dRn~Zr8%0KF6Ud&8|HF-CuV+n zZVYm!k68`HWA)Z=kWrIfeQ~{2IM&Cg>%~eenvULa%%a>EQX_!~NAW)5y09_?mBu%D z2dE$yCRW&IyHm2#XYG_T%CL5;?KGad=8~VVn)rw1KS`baFsYMtBvg(cMesm*MV2Fx zt2D=UBw{tsFdvCxZM}a=pY@`S1jZSxdl>LBSzyCM2WAYcaYPP??h#EO=10tgI31A= zG5z0o4>p7xmEsIVnKRB~aE4N64+nrDN^{UIGXP-53IGTl%@hA@We;A-VZQv^WVU)S zi@*i|C~yG)=l;vIs)(sjlE9c>1RizE;>N4cnE(I-763r>zl@_Am~>6?leSh&%=|2e vgUiu(U`j5EGH+^OYPCfUdz?9ZQB6O3%jEC-3IF#ZH4L+nJX^KFVdH-R>5Mpy diff --git a/testsrc/compbio/runner/disorder/JronnTester.java b/testsrc/compbio/runner/disorder/JronnTester.java index 2b79a20..0193781 100644 --- a/testsrc/compbio/runner/disorder/JronnTester.java +++ b/testsrc/compbio/runner/disorder/JronnTester.java @@ -19,8 +19,9 @@ package compbio.runner.disorder; import static org.testng.Assert.assertEquals; -import static org.testng.Assert.*; +import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; @@ -65,282 +66,291 @@ import compbio.util.SysPrefs; public class JronnTester { - public static String test_outfile = "TO1381.jronn.out"; // "/homes/pvtroshin/TO1381.clustal.cluster.out + public static String test_outfile = "TO1381.jronn.out"; // "/homes/pvtroshin/TO1381.clustal.cluster.out - private Jronn jronn; + private Jronn jronn; - @BeforeMethod(alwaysRun = true) - void init() { - jronn = new Jronn(); - jronn.setInput(AllTestSuit.test_input).setOutput(test_outfile); - } + @BeforeMethod(alwaysRun = true) + void init() { + jronn = new Jronn(); + jronn.setInput(AllTestSuit.test_input).setOutput(test_outfile); + } - @Test(groups = { AllTestSuit.test_group_cluster, - AllTestSuit.test_group_runner }) - public void testRunOnCluster() { - assertFalse(SysPrefs.isWindows, - "Cluster execution can only be in unix environment"); - try { - ConfiguredExecutable confJronn = Configurator - .configureExecutable(jronn, Executable.ExecProvider.Cluster); - JobRunner runner = JobRunner.getInstance(confJronn); + @Test(groups = { AllTestSuit.test_group_cluster, + AllTestSuit.test_group_runner }) + public void testRunOnCluster() { + assertFalse(SysPrefs.isWindows, + "Cluster execution can only be in unix environment"); + try { + ConfiguredExecutable confJronn = Configurator + .configureExecutable(jronn, Executable.ExecProvider.Cluster); + JobRunner runner = JobRunner.getInstance(confJronn); - assertNotNull(runner, "Runner is NULL"); - runner.executeJob(); - // assertNotNull("JobId is null", jobId1); - JobStatus status = runner.getJobStatus(); - assertTrue(status == JobStatus.PENDING - || status == JobStatus.RUNNING, - "Status of the process is wrong!"); - JobInfo info = runner.getJobInfo(); - assertNotNull(info, "JobInfo is null"); - StatisticManager sm = new StatisticManager(info); - assertNotNull(sm, "Statictic manager is null"); - try { + assertNotNull(runner, "Runner is NULL"); + runner.executeJob(); + // assertNotNull("JobId is null", jobId1); + JobStatus status = runner.getJobStatus(); + assertTrue(status == JobStatus.PENDING + || status == JobStatus.RUNNING, + "Status of the process is wrong!"); + JobInfo info = runner.getJobInfo(); + assertNotNull(info, "JobInfo is null"); + StatisticManager sm = new StatisticManager(info); + assertNotNull(sm, "Statictic manager is null"); + try { - String exits = sm.getExitStatus(); - assertNotNull("Exit status is null", exits); - // cut 4 trailing zeros from the number - int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits) - .intValue(); - assertEquals(0, exitsInt); - System.out.println(sm.getAllStats()); + String exits = sm.getExitStatus(); + assertNotNull("Exit status is null", exits); + // cut 4 trailing zeros from the number + int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits) + .intValue(); + assertEquals(0, exitsInt); + System.out.println(sm.getAllStats()); - } catch (ParseException e) { - e.printStackTrace(); - fail("Parse Exception: " + e.getMessage()); - } - //assertFalse(runner.cleanup()); - assertTrue(sm.hasExited()); - assertFalse(sm.wasAborted()); - assertFalse(sm.hasDump()); - assertFalse(sm.hasSignaled()); + } catch (ParseException e) { + e.printStackTrace(); + fail("Parse Exception: " + e.getMessage()); + } + //assertFalse(runner.cleanup()); + assertTrue(sm.hasExited()); + assertFalse(sm.wasAborted()); + assertFalse(sm.hasDump()); + assertFalse(sm.hasSignaled()); - } catch (JobSubmissionException e) { - e.printStackTrace(); - fail("DrmaaException caught:" + e.getMessage()); - } catch (JobExecutionException e) { - e.printStackTrace(); - fail("DrmaaException caught:" + e.getMessage()); - } catch (DrmaaException e) { - e.printStackTrace(); - fail("DrmaaException caught:" + e.getMessage()); - } + } catch (JobSubmissionException e) { + e.printStackTrace(); + fail("DrmaaException caught:" + e.getMessage()); + } catch (JobExecutionException e) { + e.printStackTrace(); + fail("DrmaaException caught:" + e.getMessage()); + } catch (DrmaaException e) { + e.printStackTrace(); + fail("DrmaaException caught:" + e.getMessage()); } + } - /** - * This tests fails from time to time depending on the cluster load or some - * other factors. Any client code has to adjust for this issue - */ - @Test(groups = { AllTestSuit.test_group_cluster, - AllTestSuit.test_group_runner }) - public void testRunOnClusterAsync() { - assertFalse(SysPrefs.isWindows, + /** + * This tests fails from time to time depending on the cluster load or some + * other factors. Any client code has to adjust for this issue + */ + @Test(groups = { AllTestSuit.test_group_cluster, + AllTestSuit.test_group_runner }) + public void testRunOnClusterAsync() { + assertFalse(SysPrefs.isWindows, "Cluster execution can only be in unix environment"); - try { - ConfiguredExecutable confJronn = Configurator - .configureExecutable(jronn, Executable.ExecProvider.Cluster); - AsyncExecutor aengine = Configurator.getAsyncEngine(confJronn); - String jobId = aengine.submitJob(confJronn); - assertNotNull(jobId, "Runner is NULL"); - // let drmaa to start - Thread.sleep(500); - JobStatus status = aengine.getJobStatus(jobId); - while (status != JobStatus.FINISHED) { - System.out.println("Job Status: " + status); - Thread.sleep(1000); - status = aengine.getJobStatus(jobId); - ConfiguredExecutable result = (ConfiguredExecutable) aengine.getResults(jobId); - assertNotNull(result); - System.out.println("RES:" + result); - // Some times the job could be removed from the cluster accounting - // before it has been reported to finish. Make sure - // to stop waiting in such case - if(status == JobStatus.UNDEFINED) { - break; - } - } - } catch (JobSubmissionException e) { - e.printStackTrace(); - fail("DrmaaException caught:" + e.getMessage()); - } catch (InterruptedException e) { - e.printStackTrace(); - fail(e.getMessage()); - } catch (ResultNotAvailableException e) { - e.printStackTrace(); - fail(e.getMessage()); + try { + ConfiguredExecutable confJronn = Configurator + .configureExecutable(jronn, Executable.ExecProvider.Cluster); + AsyncExecutor aengine = Configurator.getAsyncEngine(confJronn); + String jobId = aengine.submitJob(confJronn); + assertNotNull(jobId, "Runner is NULL"); + // let drmaa to start + Thread.sleep(500); + JobStatus status = aengine.getJobStatus(jobId); + while (status != JobStatus.FINISHED) { + System.out.println("Job Status: " + status); + Thread.sleep(1000); + status = aengine.getJobStatus(jobId); + ConfiguredExecutable result = (ConfiguredExecutable) aengine + .getResults(jobId); + assertNotNull(result); + System.out.println("RES:" + result); + // Some times the job could be removed from the cluster accounting + // before it has been reported to finish. Make sure + // to stop waiting in such case + if (status == JobStatus.UNDEFINED) { + break; } + } + } catch (JobSubmissionException e) { + e.printStackTrace(); + fail("DrmaaException caught:" + e.getMessage()); + } catch (InterruptedException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (ResultNotAvailableException e) { + e.printStackTrace(); + fail(e.getMessage()); } + } - @Test(groups = { AllTestSuit.test_group_runner }) - public void testRunLocally() { - try { - ConfiguredExecutable confJronn = Configurator - .configureExecutable(jronn, Executable.ExecProvider.Local); + @Test(groups = { AllTestSuit.test_group_runner }) + public void testRunLocally() { + try { + ConfiguredExecutable confJronn = Configurator + .configureExecutable(jronn, Executable.ExecProvider.Local); - // For local execution use relative - LocalRunner lr = new LocalRunner(confJronn); - lr.executeJob(); - ConfiguredExecutable al1 = lr.waitForResult(); - assertNotNull(al1.getResults()); - List al2 = confJronn.getResults(); - assertNotNull(al2); - assertEquals(al2.size(), 3); - assertEquals(al1.getResults(), al2); - } catch (JobSubmissionException e) { - e.printStackTrace(); - fail(e.getLocalizedMessage()); - } catch (ResultNotAvailableException e) { - e.printStackTrace(); - fail(e.getLocalizedMessage()); - } catch (JobExecutionException e) { - e.printStackTrace(); - fail(e.getLocalizedMessage()); - } + // For local execution use relative + LocalRunner lr = new LocalRunner(confJronn); + lr.executeJob(); + ConfiguredExecutable al1 = lr.waitForResult(); + assertNotNull(al1.getResults()); + List al2 = confJronn.getResults(); + assertNotNull(al2); + assertEquals(al2.size(), 3); + assertEquals(al1.getResults(), al2); + } catch (JobSubmissionException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } catch (ResultNotAvailableException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } catch (JobExecutionException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); } + } - @Test( groups = { AllTestSuit.test_group_runner }) - public void readStatistics() { - try { - ConfiguredExecutable confJronn = Configurator - .configureExecutable(jronn, Executable.ExecProvider.Local); - // For local execution use relavive + @Test(groups = { AllTestSuit.test_group_runner }) + public void readStatistics() { + try { + ConfiguredExecutable confJronn = Configurator + .configureExecutable(jronn, Executable.ExecProvider.Local); + // For local execution use relavive - AsyncExecutor sexec = Configurator.getAsyncEngine(confJronn); - String jobId = sexec.submitJob(confJronn); - FilePuller fw = FilePuller.newFilePuller(confJronn - .getWorkDirectory() - + File.separator + Jronn.getStatFile(), - FileWatcher.MIN_CHUNK_SIZE_BYTES); - int count = 0; - long position = 0; - fw.waitForFile(4); - JobStatus status = sexec.getJobStatus(jobId); - while (status != JobStatus.FINISHED - || fw.hasMoreData()) { - ChunkHolder ch = fw.pull(position); - String chunk = ch.getChunk(); - position = ch.getNextPosition(); - System.out.print("C: "+chunk); - count++; - // Make sure the loop is terminated if the job fails - if((status == JobStatus.UNDEFINED || status== JobStatus.FAILED)) { - break; - } - status = sexec.getJobStatus(jobId); - } - System.out.println("\nOut of the LOOP!! "); - assertTrue(count > 1); - ConfiguredExecutable al = sexec.getResults(jobId); - assertNotNull(al.getResults()); - } catch (JobSubmissionException e) { - e.printStackTrace(); - fail(e.getMessage()); - } catch (ResultNotAvailableException e) { - e.printStackTrace(); - fail(e.getMessage()); - } catch (IOException e) { - e.printStackTrace(); - fail(e.getMessage()); + AsyncExecutor sexec = Configurator.getAsyncEngine(confJronn); + String jobId = sexec.submitJob(confJronn); + FilePuller fw = FilePuller.newFilePuller(confJronn + .getWorkDirectory() + + File.separator + Jronn.getStatFile(), + FileWatcher.MIN_CHUNK_SIZE_BYTES); + int count = 0; + long position = 0; + fw.waitForFile(4); + JobStatus status = sexec.getJobStatus(jobId); + while (status != JobStatus.FINISHED) { + System.out.println((status != JobStatus.FINISHED) + " d: " + + fw.hasMoreData()); + if (fw.hasMoreData()) { + ChunkHolder ch = fw.pull(position); + System.out.println("p:" + position); + String chunk = ch.getChunk(); + position = ch.getNextPosition(); + System.out.println("np " + position + " c: " + chunk); } + count++; + // Make sure the loop is terminated if the job fails + if ((status == JobStatus.UNDEFINED || status == JobStatus.FAILED)) { + break; + } + Thread.sleep(300); + status = sexec.getJobStatus(jobId); + } + System.out.println("\nOut of the LOOP!! "); + assertTrue(count > 1); + ConfiguredExecutable al = sexec.getResults(jobId); + assertNotNull(al.getResults()); + } catch (JobSubmissionException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (ResultNotAvailableException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (IOException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (InterruptedException e) { + e.printStackTrace(); + fail(e.getMessage()); } + } - @Test(groups = { AllTestSuit.test_group_runner }) - public void testPersistance() { - try { - Jronn jronn = new Jronn(); - jronn.setError("errrr.txt").setInput(AllTestSuit.test_input) - .setOutput("outtt.txt"); - assertEquals(jronn.getInput(), AllTestSuit.test_input); - assertEquals(jronn.getError(), "errrr.txt"); - assertEquals(jronn.getOutput(), "outtt.txt"); - ConfiguredExecutable cJronn = Configurator - .configureExecutable(jronn, Executable.ExecProvider.Local); + @Test(groups = { AllTestSuit.test_group_runner }) + public void testPersistance() { + try { + Jronn jronn = new Jronn(); + jronn.setError("errrr.txt").setInput(AllTestSuit.test_input) + .setOutput("outtt.txt"); + assertEquals(jronn.getInput(), AllTestSuit.test_input); + assertEquals(jronn.getError(), "errrr.txt"); + assertEquals(jronn.getOutput(), "outtt.txt"); + ConfiguredExecutable cJronn = Configurator + .configureExecutable(jronn, Executable.ExecProvider.Local); - SyncExecutor sexec = Configurator.getSyncEngine(cJronn); - sexec.executeJob(); - ConfiguredExecutable al = sexec.waitForResult(); - assertNotNull(al.getResults()); - // Save run configuration - assertTrue(cJronn.saveRunConfiguration()); + SyncExecutor sexec = Configurator.getSyncEngine(cJronn); + sexec.executeJob(); + ConfiguredExecutable al = sexec.waitForResult(); + assertNotNull(al.getResults()); + // Save run configuration + assertTrue(cJronn.saveRunConfiguration()); - // See if loaded configuration is the same as saved - RunConfiguration loadedRun = RunConfiguration - .load(new FileInputStream(new File(cJronn - .getWorkDirectory(), RunConfiguration.rconfigFile))); - assertEquals( - ((ConfExecutable) cJronn).getRunConfiguration(), - loadedRun); - // Load run configuration as ConfExecutable - ConfiguredExecutable resurrectedCMuscle = (ConfiguredExecutable) cJronn - .loadRunConfiguration(new FileInputStream(new File(cJronn - .getWorkDirectory(), RunConfiguration.rconfigFile))); - assertNotNull(resurrectedCMuscle); - assertEquals(resurrectedCMuscle.getExecutable().getInput(), - AllTestSuit.test_input); - assertEquals(resurrectedCMuscle.getExecutable().getError(), - "errrr.txt"); - assertEquals(resurrectedCMuscle.getExecutable().getOutput(), - "outtt.txt"); - // See in details whether executables are the same - assertEquals(resurrectedCMuscle.getExecutable(), jronn); + // See if loaded configuration is the same as saved + RunConfiguration loadedRun = RunConfiguration + .load(new FileInputStream(new File(cJronn + .getWorkDirectory(), RunConfiguration.rconfigFile))); + assertEquals( + ((ConfExecutable) cJronn).getRunConfiguration(), + loadedRun); + // Load run configuration as ConfExecutable + ConfiguredExecutable resurrectedCMuscle = (ConfiguredExecutable) cJronn + .loadRunConfiguration(new FileInputStream(new File(cJronn + .getWorkDirectory(), RunConfiguration.rconfigFile))); + assertNotNull(resurrectedCMuscle); + assertEquals(resurrectedCMuscle.getExecutable().getInput(), + AllTestSuit.test_input); + assertEquals(resurrectedCMuscle.getExecutable().getError(), + "errrr.txt"); + assertEquals(resurrectedCMuscle.getExecutable().getOutput(), + "outtt.txt"); + // See in details whether executables are the same + assertEquals(resurrectedCMuscle.getExecutable(), jronn); - ConfiguredExecutable resJronn = Configurator - .configureExecutable(resurrectedCMuscle.getExecutable(), - Executable.ExecProvider.Local); + ConfiguredExecutable resJronn = Configurator + .configureExecutable(resurrectedCMuscle.getExecutable(), + Executable.ExecProvider.Local); - sexec = Configurator.getSyncEngine(resJronn, - Executable.ExecProvider.Local); - sexec.executeJob(); - al = sexec.waitForResult(); - assertNotNull(al); + sexec = Configurator.getSyncEngine(resJronn, + Executable.ExecProvider.Local); + sexec.executeJob(); + al = sexec.waitForResult(); + assertNotNull(al); - } catch (JobSubmissionException e) { - e.printStackTrace(); - fail(e.getMessage()); - } catch (JobExecutionException e) { - e.printStackTrace(); - fail(e.getMessage()); - } catch (FileNotFoundException e) { - e.printStackTrace(); - fail(e.getMessage()); - } catch (IOException e) { - e.printStackTrace(); - fail(e.getMessage()); - } catch (ResultNotAvailableException e) { - e.printStackTrace(); - fail(e.getMessage()); - } + } catch (JobSubmissionException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (JobExecutionException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (FileNotFoundException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (IOException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (ResultNotAvailableException e) { + e.printStackTrace(); + fail(e.getMessage()); } + } - @Test(groups = { AllTestSuit.test_group_runner }) - public void testConfigurationLoading() { - try { - RunnerConfig jronnConfig = ConfExecutable - .getRunnerOptions(Jronn.class); - assertNotNull(jronnConfig); - assertTrue(jronnConfig.getArguments().size() > 0); + @Test(groups = { AllTestSuit.test_group_runner }) + public void testConfigurationLoading() { + try { + RunnerConfig jronnConfig = ConfExecutable + .getRunnerOptions(Jronn.class); + assertNotNull(jronnConfig); + assertTrue(jronnConfig.getArguments().size() > 0); - PresetManager jronnPresets = ConfExecutable - .getRunnerPresets(Jronn.class); - assertNull(jronnPresets); // there is no presets + PresetManager jronnPresets = ConfExecutable + .getRunnerPresets(Jronn.class); + assertNull(jronnPresets); // there is no presets - LimitsManager jronnLimits = ConfExecutable - .getRunnerLimits(Jronn.class); - assertNotNull(jronnLimits); - assertTrue(jronnLimits.getLimits().size() > 0); - jronnLimits.validate(jronnPresets); + LimitsManager jronnLimits = ConfExecutable + .getRunnerLimits(Jronn.class); + assertNotNull(jronnLimits); + assertTrue(jronnLimits.getLimits().size() > 0); + jronnLimits.validate(jronnPresets); - } catch (FileNotFoundException e) { - e.printStackTrace(); - fail(e.getLocalizedMessage()); - } catch (IOException e) { - e.printStackTrace(); - fail(e.getLocalizedMessage()); - } catch (ValidationException e) { - e.printStackTrace(); - fail(e.getLocalizedMessage()); - } + } catch (FileNotFoundException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } catch (IOException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } catch (ValidationException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); } + } } -- 1.7.10.2