testNotifier.prepare();
}
public final void run(IHookCallBack callBack, ITestResult testResult) {
testNotifier.fireBeforeTest(testResult.getMethod().getMethod());
TestExecution testExecution = (TestExecution) Mycila.currentExecution();
if (testExecution.mustSkip()) {
testResult.setStatus(ITestResult.SKIP);
} else {
LOGGER.debug("Calling test method {0}.{1}", testExecution.method().getDeclaringClass().getName(), testExecution.method().getName());
try {
Field field = callBack.getClass().getDeclaredField("val$instance");
field.setAccessible(true);
MethodHelper.invokeMethod(testResult.getMethod().getMethod(), field.get(callBack), testResult.getParameters());
} catch (Throwable e) {
testExecution.setThrowable(e);
}
}
try {
testNotifier.fireAfterTest();
} catch (TestPluginException e) {
testExecution.setThrowable(e);
}
//noinspection ThrowableResultOfMethodCallIgnored
testResult.setThrowable(testExecution.throwable());
}