String (Object[] parameters, boolean config, int invocationCount) { String paramString = ""; if (parameters.length > 0) { if (config) { Object parameter = parameters[0]; if (parameter != null) { Class<?> parameterClass = parameter.getClass(); if (ITestResult.class.isAssignableFrom(parameterClass) || ITestContext.class.isAssignableFrom(parameterClass) || Method.class.isAssignableFrom(parameterClass)) { try { paramString = "[" + parameterClass.getMethod("getName").invoke(parameter) + "]"; } catch (Throwable e) { paramString = ""; } } else { paramString = "[" + parameter + "]"; } } } else { paramString = Arrays.deepToString(parameters); } } if (invocationCount > 0) { paramString += " (" + invocationCount + ")"; } return !paramString.isEmpty() ? paramString : null; }