Source:
<code>private void init(IConfiguration configuration, XmlSuite suite, String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, List<IMethodInterceptor> methodInterceptors, List<IInvokedMethodListener> invokedMethodListener, List<ITestListener> testListeners) { m_configuration = configuration; m_suite = suite; m_useDefaultListeners = useDefaultListeners; m_tmpRunnerFactory= runnerFactory; m_methodInterceptors = methodInterceptors; setOutputDir(outputDir); m_objectFactory = m_configuration.getObjectFactory(); if(m_objectFactory == null) { m_objectFactory = suite.getObjectFactory(); } m_invokedMethodListeners = invokedMethodListener; if (m_invokedMethodListeners == null) { m_invokedMethodListeners = Lists.newArrayList(); } m_invokedMethodListeners.add(this); m_skipFailedInvocationCounts = suite.skipFailedInvocationCounts(); if (null != testListeners) { m_testListeners.addAll(testListeners); } m_runnerFactory = buildRunnerFactory(); List<XmlTest> xmlTests = m_suite.getTests(); Collections.sort(xmlTests, new Comparator<XmlTest>() { @Override public int compare(XmlTest arg0, XmlTest arg1) { return arg0.getIndex() - arg1.getIndex(); } }); for (XmlTest test : xmlTests) { TestRunner tr = m_runnerFactory.newTestRunner(this, test, m_invokedMethodListeners); <START> if (!m_methodInterceptors.isEmpty()) { <END> for (IMethodInterceptor methodInterceptor : methodInterceptors) { tr.addMethodInterceptor(methodInterceptor); } } tr.addListener(m_textReporter); m_testRunners.add(tr); m_allTestMethods.addAll(Arrays.asList(tr.getAllTestMethods())); } }</code><technical_language>this condition is helpful iterators work empty lists. check null send null (even if I create a new list if null better)</technical_language>

Target:
private void init(IConfiguration configuration, XmlSuite suite, String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, List<IMethodInterceptor> methodInterceptors, List<IInvokedMethodListener> invokedMethodListener, List<ITestListener> testListeners) { m_configuration = configuration; m_suite = suite; m_useDefaultListeners = useDefaultListeners; m_tmpRunnerFactory= runnerFactory; m_methodInterceptors = methodInterceptors != null ? methodInterceptors : new ArrayList<IMethodInterceptor>(); setOutputDir(outputDir); m_objectFactory = m_configuration.getObjectFactory(); if(m_objectFactory == null) { m_objectFactory = suite.getObjectFactory(); } m_invokedMethodListeners = invokedMethodListener; if (m_invokedMethodListeners == null) { m_invokedMethodListeners = Lists.newArrayList(); } m_invokedMethodListeners.add(this); m_skipFailedInvocationCounts = suite.skipFailedInvocationCounts(); if (null != testListeners) { m_testListeners.addAll(testListeners); } m_runnerFactory = buildRunnerFactory(); List<XmlTest> xmlTests = m_suite.getTests(); Collections.sort(xmlTests, new Comparator<XmlTest>() { @Override public int compare(XmlTest arg0, XmlTest arg1) { return arg0.getIndex() - arg1.getIndex(); } }); for (XmlTest test : xmlTests) { TestRunner tr = m_runnerFactory.newTestRunner(this, test, m_invokedMethodListeners); for (IMethodInterceptor methodInterceptor : methodInterceptors) { tr.addMethodInterceptor(methodInterceptor); } tr.addListener(m_textReporter); m_testRunners.add(tr); m_allTestMethods.addAll(Arrays.asList(tr.getAllTestMethods())); } }