4. 执行testng的一系列操作之添加监听器
//如果监听器不为空则把监听器listener对象加入到testng对象的监听器中
if (null != listener) {
result.addListener((Object)listener);
}
/**
* @deprecated Use addListener(ITestNGListener) instead
*/
// TODO remove later /!\ Caution: IntelliJ is using it. Check with @akozlova before removing it
@Deprecated
public void addListener(Object listener) {
//如果监听器不是ITestNGListener这种类型则报错退出exitWithError,否则执行addListener((ITestNGListener) listener)
if (! (listener instanceof ITestNGListener))
{
exitWithError("Listener " + listener
+ " must be one of ITestListener, ISuiteListener, IReporter, "
+ " IAnnotationTransformer, IMethodInterceptor or IInvokedMethodListener");
}
addListener((ITestNGListener) listener);
}
private final Map<Class<? extends ISuiteListe