diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBOTest.java index 6eb77e06d1dbacab56ed7800f8c4fc5f06477444..4a901bee50f61e4141d14276212d06734fe173d6 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBOTest.java @@ -21,6 +21,7 @@ import java.lang.reflect.Method; import org.jmock.Expectations; import org.jmock.Mockery; import org.testng.AssertJUnit; +import org.testng.ITestResult; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -195,15 +196,19 @@ public abstract class AbstractBOTest extends AssertJUnit } @AfterMethod - public void afterMethod(Method m) + public void afterMethod(ITestResult result, Method m) { - try + // only run assertions if has not failed + if (result.isSuccess()) { - context.assertIsSatisfied(); - } catch (Throwable t) - { - // assert expectations were met, including the name of the failed method - throw new Error(m.getName() + "() : ", t); + try + { + context.assertIsSatisfied(); + } catch (Throwable t) + { + // assert expectations were met, including the name of the failed method + throw new Error(m.getName() + "() : ", t); + } } }