@@ -0,0 +1,2162 @@
+/*%0A  This file is licensed to You under the Apache License, Version 2.0%0A  (the %22License%22); you may not use this file except in compliance with%0A  the License.  You may obtain a copy of the License at%0A%0A  http://www.apache.org/licenses/LICENSE-2.0%0A%0A  Unless required by applicable law or agreed to in writing, software%0A  distributed under the License is distributed on an %22AS IS%22 BASIS,%0A  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A  See the License for the specific language governing permissions and%0A  limitations under the License.%0A*/%0Apackage net.sf.xmlunit.util;%0A%0Aimport java.io.File;%0Aimport java.io.FileInputStream;%0Aimport javax.xml.parsers.DocumentBuilder;%0Aimport javax.xml.parsers.DocumentBuilderFactory;%0Aimport javax.xml.transform.Source;%0Aimport javax.xml.transform.dom.DOMSource;%0Aimport javax.xml.transform.sax.SAXSource;%0Aimport javax.xml.transform.stream.StreamSource;%0Aimport org.hamcrest.core.IsNull;%0Aimport org.junit.Test;%0Aimport org.w3c.dom.Document;%0Aimport org.xml.sax.InputSource;%0A%0Aimport static org.junit.Assert.assertThat;%0Aimport static org.hamcrest.core.Is.is;%0A%0Apublic class ConvertTest %7B%0A%0A    private static final String TEST_FILE = %22src/tests/resources/test1.xml%22;%0A%0A    private static void convertAndAssert(Source s) throws Exception %7B%0A        DocumentBuilder b =%0A            DocumentBuilderFactory.newInstance().newDocumentBuilder();%0A        Document d = b.parse(Convert.toInputSource(s));%0A        assertThat(d, IsNull.notNullValue());%0A        assertThat(d.getDocumentElement().getTagName(), is(%22animal%22));%0A    %7D%0A%0A    @Test public void streamSourceToInputSource() throws Exception %7B%0A        convertAndAssert(new StreamSource(new File(TEST_FILE)));%0A    %7D%0A%0A    @Test public void domSourceToInputSource() throws Exception %7B%0A        DocumentBuilder b =%0A            DocumentBuilderFactory.newInstance().newDocumentBuilder();%0A        Document d = b.parse(new File(TEST_FILE));%0A        convertAndAssert(new DOMSource(d));%0A    %7D%0A%0A    @Test public void saxSourceToInputSource() throws Exception %7B%0A        InputSource s = new InputSource(new FileInputStream(TEST_FILE));%0A        convertAndAssert(new SAXSource(s));%0A    %7D%0A%0A%7D%0A

test for convert