// Path: src/test/org/diffxml/diffxml/TestDocHelper.java
// public final class TestDocHelper {
// 
//     /**
//      * Private constructor.
//      */
//     private TestDocHelper() {
//         //SHouldn't be called
//     }
//     
//     /**
//      * Create an XML Document from a string of XML.
//      * 
//      * Calls fail if any exception is thrown.
//      * 
//      * @param xml The XML to turn into a document.
//      * @return A DOM document representing the string.
//      */
//     public static Document createDocument(final String xml) {
//         
//         Document ret = null;
//         DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
//         DOMOps.initParser(fac);
//                 
//         try {
//             ByteArrayInputStream is = new ByteArrayInputStream(
//                     xml.getBytes("utf-8"));
//             ret = fac.newDocumentBuilder().parse(is);
//         } catch (UnsupportedEncodingException e) {
//             fail("No utf-8 encoder!");
//         } catch (ParserConfigurationException e) {
//             fail("Error configuring parser: " + e.getMessage());
//         } catch (IOException e) {
//             fail("Caught IOException: " + e.getMessage());
//         } catch (SAXException e) {
//             fail("Caught SAXexception: " + e.getMessage());
//         }
//         
//         return ret;
// 
//     }
// }


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import org.diffxml.diffxml.TestDocHelper;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.Ignore;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
        //<a>newtext<b attr='c'><!-- comment --></b></a>
        
        NodePairs matches = Match.easyMatch(mTestDoc2a, mTestDoc4a);
        
        Node aDocEl = mTestDoc2a.getDocumentElement();
        Node partner = matches.getPartner(aDocEl);
        
        Node bDocEl = mTestDoc4a.getDocumentElement();
        assertEquals(bDocEl, partner);
        
        Node aText = aDocEl.getFirstChild();
        assertNull(matches.getPartner(aText));
        
        Node aB = aText.getNextSibling();
        assertNull(matches.getPartner(aB));

        Node aComment = aB.getFirstChild();
        partner = matches.getPartner(aComment);
        
        Node bComment = bDocEl.getFirstChild().getNextSibling().getFirstChild();
        assertEquals(bComment, partner);
        
    }

    /**
     * Test documents with same elements but in different order match 
     * completely.
     */
    @Test
    public final void testDifferentOrdering() {
// Path: src/test/org/diffxml/diffxml/TestDocHelper.java
// public final class TestDocHelper {
// 
//     /**
//      * Private constructor.
//      */
//     private TestDocHelper() {
//         //SHouldn't be called
//     }
//     
//     /**
//      * Create an XML Document from a string of XML.
//      * 
//      * Calls fail if any exception is thrown.
//      * 
//      * @param xml The XML to turn into a document.
//      * @return A DOM document representing the string.
//      */
//     public static Document createDocument(final String xml) {
//         
//         Document ret = null;
//         DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
//         DOMOps.initParser(fac);
//                 
//         try {
//             ByteArrayInputStream is = new ByteArrayInputStream(
//                     xml.getBytes("utf-8"));
//             ret = fac.newDocumentBuilder().parse(is);
//         } catch (UnsupportedEncodingException e) {
//             fail("No utf-8 encoder!");
//         } catch (ParserConfigurationException e) {
//             fail("Error configuring parser: " + e.getMessage());
//         } catch (IOException e) {
//             fail("Caught IOException: " + e.getMessage());
//         } catch (SAXException e) {
//             fail("Caught SAXexception: " + e.getMessage());
//         }
//         
//         return ret;
// 
//     }
// }


// Path: src/test/org/diffxml/diffxml/fmes/MatchTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import org.diffxml.diffxml.TestDocHelper;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.Ignore;
import org.w3c.dom.Document;
import org.w3c.dom.Node;

        //<a>newtext<b attr='c'><!-- comment --></b></a>
        
        NodePairs matches = Match.easyMatch(mTestDoc2a, mTestDoc4a);
        
        Node aDocEl = mTestDoc2a.getDocumentElement();
        Node partner = matches.getPartner(aDocEl);
        
        Node bDocEl = mTestDoc4a.getDocumentElement();
        assertEquals(bDocEl, partner);
        
        Node aText = aDocEl.getFirstChild();
        assertNull(matches.getPartner(aText));
        
        Node aB = aText.getNextSibling();
        assertNull(matches.getPartner(aB));

        Node aComment = aB.getFirstChild();
        partner = matches.getPartner(aComment);
        
        Node bComment = bDocEl.getFirstChild().getNextSibling().getFirstChild();
        assertEquals(bComment, partner);
        
    }

    /**
     * Test documents with same elements but in different order match 
     * completely.
     */
    @Test
    public final void testDifferentOrdering() {
        Document doc1 = TestDocHelper.createDocument(