All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.testng.xml.SuiteXmlParser Maven / Gradle / Ivy

There is a newer version: 7.10.1
Show newest version
package org.testng.xml;

import org.testng.TestNGException;
import org.xml.sax.SAXException;

import java.io.IOException;
import java.io.InputStream;

public class SuiteXmlParser extends XMLParser implements ISuiteParser {

  @Override
  public XmlSuite parse(String currentFile, InputStream inputStream, boolean loadClasses) {
    TestNGContentHandler contentHandler = new TestNGContentHandler(currentFile, loadClasses);

    try {
      parse(inputStream, contentHandler);

      return contentHandler.getSuite();
    } catch (SAXException | IOException e) {
      throw new TestNGException(e);
    }
  }

  @Override
  public boolean accept(String fileName) {
    return Parser.hasFileScheme(fileName) && fileName.endsWith(".xml");
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy