From 016e54aad9c826ec633f6620bd65113669b2d91f Mon Sep 17 00:00:00 2001 From: kaloyane <kaloyane> Date: Wed, 13 Apr 2011 11:40:15 +0000 Subject: [PATCH] minor: verify mock expectations only when the test has not failed SVN: 20876 --- .../plugins/standard/RsyncArchiverTest.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/RsyncArchiverTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/RsyncArchiverTest.java index e3700c15346..6f03908b2f2 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/RsyncArchiverTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/RsyncArchiverTest.java @@ -30,6 +30,7 @@ import org.jmock.Mockery; import org.springframework.aop.TargetSource; import org.springframework.aop.framework.Advised; import org.springframework.beans.factory.BeanFactory; +import org.testng.ITestResult; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -175,7 +176,7 @@ public class RsyncArchiverTest extends AbstractFileSystemTestCase } @AfterMethod - public void afterMethod(Method method) + public void afterMethod(ITestResult testResult, Method method) { System.out.println("======= Log content for " + method.getName()+"():"); System.out.println(logRecorder.getLogContent()); @@ -183,13 +184,16 @@ public class RsyncArchiverTest extends AbstractFileSystemTestCase logRecorder.reset(); ServiceProviderTestWrapper.restoreApplicationContext(); IncomingShareIdProviderTestWrapper.restoreOriginalShareIds(); - try + if (testResult.isSuccess()) { - context.assertIsSatisfied(); - } catch (Throwable t) - { - // assert expectations were met, including the name of the failed method - throw new Error(method.getName() + "() : ", t); + try + { + context.assertIsSatisfied(); + } catch (Throwable t) + { + // assert expectations were met, including the name of the failed method + throw new Error(method.getName() + "() : ", t); + } } } -- GitLab