Skip to content
Snippets Groups Projects
Commit 016e54aa authored by kaloyane's avatar kaloyane
Browse files

minor: verify mock expectations only when the test has not failed

SVN: 20876
parent 1b80384a
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment