core/src/main/java/org/testng/reporters/FailedReporter.java
private List<XmlClass> createXmlClasses(List<ITestNGMethod> methods, XmlTest srcXmlTest) {
    List<XmlClass> result = Lists.newArrayList();
    Map<Class<?>, Set<ITestNGMethod>> methodsMap = Maps.newHashMap();

    for (ITestNGMethod m : methods) {
      Object instances = m.getInstance();
      Class<?> clazz = instances == null ? m.getRealClass() : instances.getClass();
      Set<ITestNGMethod> methodList = methodsMap.computeIfAbsent(clazz, k -> Sets.newHashSet());
      methodList.add(m);
    }

    // Store parameters per XmlClass

    Map<String,  Map<String,  String>> classParameters = Maps.newHashMap();
    for (XmlClass c : srcXmlTest.getClasses()) {
      classParameters.put(c.getName(),c.getLocalParameters());
    }

    int index = 0;
    for (Map.Entry<Class<?>, Set<ITestNGMethod>> entry : methodsMap.entrySet()) {
      Class<?> clazz = entry.getKey();
      Set<ITestNGMethod> methodList = entry.getValue();
      // @author Borojevic
      // Need to check all the methods, not just @Test ones.
      XmlClass xmlClass = new XmlClass(clazz.getName(), index++, false /* don't load classes */);
      List<XmlInclude> methodNames = Lists.newArrayList(methodList.size());
      int ind = 0;
      for (ITestNGMethod m : methodList) {

        XmlInclude methodName =
            new XmlInclude(m.getMethodName(), m.getFailedInvocationNumbers(), ind++);
        methodName.setParameters(findMethodLocalParameters(srcXmlTest, m));
        methodNames.add(methodName);
      }
      xmlClass.setIncludedMethods(methodNames);
      xmlClass.setParameters(classParameters.getOrDefault(xmlClass.getName(), classParameters
              .values()
              .stream()
              .flatMap(map -> map.entrySet().stream())
              .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (v1, v2)-> v2))));
      result.add(xmlClass);
    }

    return result;
  }
/**
   * @param methods The methods we want to represent
   * @param srcXmlTest The {@link XmlTest} object that represents the source.
   * @return A list of XmlClass objects (each representing a <class> tag) based on the parameter
   *     methods
   */
@param methods The methods we want to represent
@param srcXmlTest The  XmlTest object that represents the source.
@return A list of XmlClass objects (each representing a  tag) based on the parameter
methods
@param methods The methods we want to represent @param srcXmlTest The XmlTest object that represents the source . @return A list of XmlClass objects ( each representing a tag ) based on the parameter methods
private List<XmlClass> createXmlClasses(List<ITestNGMethod> methods, XmlTest srcXmlTest) {
    List<XmlClass> result = Lists.newArrayList();
    Map<Class<?>, Set<ITestNGMethod>> methodsMap = Maps.newHashMap();
    for (ITestNGMethod m : methods) {
      Object instances = m.getInstance();
      Class<?> clazz = instances == null ? m.getRealClass() : instances.getClass();
      Set<ITestNGMethod> methodList = methodsMap.computeIfAbsent(clazz, k -> Sets.newHashSet());
      methodList.add(m);
    }
    Map<String,  Map<String,  String>> classParameters = Maps.newHashMap();
    for (XmlClass c : srcXmlTest.getClasses()) {
      classParameters.put(c.getName(),c.getLocalParameters());
    }
    int index = 0;
    for (Map.Entry<Class<?>, Set<ITestNGMethod>> entry : methodsMap.entrySet()) {
      Class<?> clazz = entry.getKey();
      Set<ITestNGMethod> methodList = entry.getValue();
      XmlClass xmlClass = new XmlClass(clazz.getName(), index++, false /* don't load classes */);
      List<XmlInclude> methodNames = Lists.newArrayList(methodList.size());
      int ind = 0;
      for (ITestNGMethod m : methodList) {
        XmlInclude methodName =
            new XmlInclude(m.getMethodName(), m.getFailedInvocationNumbers(), ind++);
        methodName.setParameters(findMethodLocalParameters(srcXmlTest, m));
        methodNames.add(methodName);
      }
      xmlClass.setIncludedMethods(methodNames);
      xmlClass.setParameters(classParameters.getOrDefault(xmlClass.getName(), classParameters
              .values()
              .stream()
              .flatMap(map -> map.entrySet().stream())
              .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (v1, v2)-> v2))));
      result.add(xmlClass);
    }
    return result;
  }
private List < XmlClass > createXmlClasses ( List < ITestNGMethod > methods , XmlTest srcXmlTest ) { List < XmlClass > result = Lists . newArrayList ( ) ; Map < Class < ? > , Set < ITestNGMethod > > methodsMap = Maps . newHashMap ( ) ; for ( ITestNGMethod m : methods ) { Object instances = m . getInstance ( ) ; Class < ? > clazz = instances == null ? m . getRealClass ( ) : instances . getClass ( ) ; Set < ITestNGMethod > methodList = methodsMap . computeIfAbsent ( clazz , k -> Sets . newHashSet ( ) ) ; methodList . add ( m ) ; } Map < String , Map < String , String > > classParameters = Maps . newHashMap ( ) ; for ( XmlClass c : srcXmlTest . getClasses ( ) ) { classParameters . put ( c . getName ( ) , c . getLocalParameters ( ) ) ; } int index = 0 ; for ( Map . Entry < Class < ? > , Set < ITestNGMethod > > entry : methodsMap . entrySet ( ) ) { Class < ? > clazz = entry . getKey ( ) ; Set < ITestNGMethod > methodList = entry . getValue ( ) ; XmlClass xmlClass = new XmlClass ( clazz . getName ( ) , index ++ , false /* don't load classes */ ) ; List < XmlInclude > methodNames = Lists . newArrayList ( methodList . size ( ) ) ; int ind = 0 ; for ( ITestNGMethod m : methodList ) { XmlInclude methodName = new XmlInclude ( m . getMethodName ( ) , m . getFailedInvocationNumbers ( ) , ind ++ ) ; methodName . setParameters ( findMethodLocalParameters ( srcXmlTest , m ) ) ; methodNames . add ( methodName ) ; } xmlClass . setIncludedMethods ( methodNames ) ; xmlClass . setParameters ( classParameters . getOrDefault ( xmlClass . getName ( ) , classParameters . values ( ) . stream ( ) . flatMap ( map -> map . entrySet ( ) . stream ( ) ) . collect ( Collectors . toMap ( Map . Entry :: getKey , Map . Entry :: getValue , ( v1 , v2 ) -> v2 ) ) ) ) ; result . add ( xmlClass ) ; } return result ; }
@param methods The methods we want to represent
 @param srcXmlTest The {@link XmlTest} object that represents the source.
@param methods The methods we want to represent @param srcXmlTest The { @link XmlTest } object that represents the source .
// Store parameters per XmlClass // @author Borojevic // Need to check all the methods, not just @Test ones.