Class XmlTestHelper


  • public class XmlTestHelper
    extends java.lang.Object
    • Constructor Detail

      • XmlTestHelper

        public XmlTestHelper​(java.lang.String tmpDirPath,
                             GhidraProject gp)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • XmlTestHelper

        public XmlTestHelper​(java.lang.String tmpDirPath)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • dispose

        public void dispose()
      • add

        public void add​(java.lang.String xml)
      • loadXmlResource

        public void loadXmlResource​(java.lang.Package pkg,
                                    java.lang.String name)
                             throws java.io.IOException
        Read an XML file as a resource.
        Parameters:
        package - where resource resides
        name - name of the resource that is in the given package
        Throws:
        java.io.IOException
      • getTempFile

        public java.io.File getTempFile​(java.lang.String name)
      • compareXml

        public void compareXml​(java.io.File file)
                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • containsXml

        public boolean containsXml​(java.lang.String line)
        Return true if the given line is in the the xml list.
      • printExpectedLines

        public void printExpectedLines()
      • getXmlParser

        public XmlPullParser getXmlParser​(java.lang.String name)
                                   throws java.io.IOException,
                                          org.xml.sax.SAXException
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
      • clearXml

        public void clearXml()
      • assertXMLFilesEquals

        public static void assertXMLFilesEquals​(java.io.File expectedXMLFile,
                                                java.io.File testXMLFile)
                                         throws org.xml.sax.SAXException,
                                                java.io.IOException
        Parameters:
        expectedXMLFile -
        testXMLFile -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • assertXMLFilesEquals

        public static void assertXMLFilesEquals​(XmlPullParser expectedXMLParser,
                                                XmlPullParser testXMLParser)
                                         throws org.xml.sax.SAXException,
                                                java.io.IOException
        Compares 2 xml files and fails if there is any difference between the two.

        Elements must be ordered in the same order. Attribute values are not order sensitive.

        Inter-node whitespace differences are ignored.

        DTD definitions are ignored.

        Parameters:
        expectedXMLParser -
        testXMLParser -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException