|
| 1 | +package be.hikage.xdt4j; |
| 2 | + |
| 3 | +import be.hikage.xdt4j.util.TestUtils; |
| 4 | +import org.custommonkey.xmlunit.XMLAssert; |
| 5 | +import org.custommonkey.xmlunit.exceptions.XpathException; |
| 6 | +import org.dom4j.Document; |
| 7 | +import org.dom4j.DocumentException; |
| 8 | +import org.intellij.lang.annotations.Language; |
| 9 | +import org.junit.Before; |
| 10 | +import org.junit.Test; |
| 11 | +import org.xml.sax.SAXException; |
| 12 | + |
| 13 | +import java.io.IOException; |
| 14 | + |
| 15 | +import static be.hikage.xdt4j.util.TestUtils.loadXml; |
| 16 | + |
| 17 | +/** |
| 18 | + * Created by IntelliJ IDEA. |
| 19 | + * User: hikage |
| 20 | + * Date: 21/12/11 |
| 21 | + * Time: 11:36 |
| 22 | + * To change this template use File | Settings | File Templates. |
| 23 | + */ |
| 24 | +public class XdtTransformerTest { |
| 25 | + |
| 26 | + private Document baseDocument; |
| 27 | + |
| 28 | + @Before |
| 29 | + public void setUp() throws Exception { |
| 30 | + |
| 31 | + baseDocument = loadXml("SampleBase.xml"); |
| 32 | + } |
| 33 | + |
| 34 | + @Test |
| 35 | + public void TestIdentityTransform() throws DocumentException, IOException, SAXException, XpathException { |
| 36 | + @Language("XML") |
| 37 | + String transformInstruction = "<configuration xmlns:xdt=\"http://schemas.microsoft.com/XML-Document-Transform\" />"; |
| 38 | + Document transformDocument = TestUtils.loadXmlFromString(transformInstruction); |
| 39 | + |
| 40 | + |
| 41 | + XdtTransformer transformer = new XdtTransformer(); |
| 42 | + Document result = transformer.transform(baseDocument, transformDocument); |
| 43 | + |
| 44 | + XMLAssert.assertXMLEqual(baseDocument.asXML(), result.asXML()); |
| 45 | + |
| 46 | + } |
| 47 | + |
| 48 | + |
| 49 | +} |
0 commit comments