KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtworks > xstream > io > xml > DomWriterTest


1 package com.thoughtworks.xstream.io.xml;
2
3 import org.w3c.dom.Document JavaDoc;
4
5 import javax.xml.parsers.DocumentBuilder JavaDoc;
6 import javax.xml.parsers.DocumentBuilderFactory JavaDoc;
7
8 public class DomWriterTest extends AbstractXMLWriterTest {
9
10     private Document JavaDoc document;
11
12     protected void setUp() throws Exception JavaDoc {
13         super.setUp();
14         DocumentBuilderFactory JavaDoc documentBuilderFactory = DocumentBuilderFactory.newInstance();
15         DocumentBuilder JavaDoc documentBuilder = documentBuilderFactory.newDocumentBuilder();
16         document = documentBuilder.newDocument();
17         writer = new DomWriter(document);
18     }
19
20     protected void assertXmlProducedIs(String JavaDoc expected) {
21         // conver w3c doc to dom4j doc
22
org.dom4j.io.DOMReader domReader = new org.dom4j.io.DOMReader();
23         org.dom4j.Document dom4Jdoc = domReader.read(document);
24         String JavaDoc actual = dom4Jdoc.getRootElement().asXML();
25         assertEquals(expected, actual);
26     }
27
28     // inherits tests from superclass
29

30     public void testEscapesWhitespaceCharacters() {
31         // TODO: Support whitespaces.
32
// This method overrides a test in the superclass to prevent it from being run.
33
}
34 }
35
Popular Tags