TextImpl extends NodeImpl implements Text { @Override public org.w3c.dom.Text asXmlNode(Document document) { return document.createTextNode(text); } TextImpl(String text); @Override org.w3c.dom.Text asXmlNode(Document document); String getText(); String getPlainText(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testAsXmlNode() { TextImpl text = new TextImpl("abc"); Node node = text.asXmlNode(Utils.createDocument()); assertTrue(node instanceof Text); assertEquals("abc", node.getTextContent()); }