@Override public void afterTestMethod(TestContext testContext) throws Exception { Object spyAttribute = getAttribute(testContext, SPY_ATTRIBUTE_NAME); removeAttribute(testContext, SPY_ATTRIBUTE_NAME); if (null != spyAttribute) { Spy spy = (Spy) spyAttribute; try { spy.close(); } catch (WrongNumberOfQueriesError jdbcSnifferError) { Throwable throwable = getTestException(testContext); if (null != throwable) { if (!ExceptionUtil.addSuppressed(throwable, jdbcSnifferError)) { jdbcSnifferError.printStackTrace(); } } else { throw jdbcSnifferError; } } } }