File (Map<String, Map<String, List<String>>> map, String name, String rootPath, Logger logger, boolean requireHttp, XmlSuite xmlSuite) { XmlTest xmlTest = new XmlTest(xmlSuite); xmlTest.setName(name); List<XmlClass> xmlClasses = new ArrayList<>(); int idx = 0; for (String className : map.keySet()) { final XmlClass xmlClass = new XmlClass(className, idx++, false); final Map<String, List<String>> collection = map.get(className); if (collection != null) { final ArrayList<XmlInclude> includedMethods = new ArrayList<>(); int mIdx = 0; for (String methodName : collection.keySet()) { final List<Integer> includes = new ArrayList<>(); for (String include : collection.get(methodName)) { try { includes.add(Integer.parseInt(include)); } catch (NumberFormatException e) { logger.log(e); } } includedMethods.add(new XmlInclude(methodName, includes, mIdx++)); } xmlClass.setIncludedMethods(includedMethods); } xmlClasses.add(xmlClass); } xmlTest.setXmlClasses(xmlClasses); File xmlFile = new File(rootPath, "temp-testng-customsuite.xml"); String toXml = xmlSuite.toXml(); if (requireHttp) { String target = "https://testng.org/" + Parser.TESTNG_DTD; int dtdIdx = toXml.indexOf(target); if (dtdIdx > 0) { toXml = toXml.substring(0, dtdIdx) + Parser.TESTNG_DTD_URL + toXml.substring(dtdIdx + target.length()); } } writeToFile(logger, xmlFile, toXml); return xmlFile; }