XmlConverters { public static Source the(Source xml) { return xml; } private  XmlConverters(); static Source the(Source xml); static Source the(String xml); static Source the(final Node node); static Source the(StringResult xml); static Source xml(Source xml); static Source xml(String xml); static Source xml(Node node); static Source xml(StringResult xml);  }
@Test public void theConvertsASourceToASource() { Source source = StringSource.toSource(xml); assertNotNull(the(source)); }
@Test public void theConvertsAStringToASource() { assertNotNull(the(xml)); }
@Test public void theConvertsANodeToASource() throws Exception { Element element = DocumentBuilderFactory.newInstance() .newDocumentBuilder() .parse(new ByteArrayInputStream(xml.getBytes())) .getDocumentElement(); assertNotNull(the(element)); }
@Test public void theConvertsANodeToASourceHasAFriendlyToString() throws Exception { Element element = DocumentBuilderFactory.newInstance() .newDocumentBuilder() .parse(new ByteArrayInputStream(xml.getBytes())) .getDocumentElement(); Source source = the(element); assertThat(the(source.toString()), isEquivalentTo(the(xml))); }
@Test public void theConvertsAStringResultToASource() throws Exception { IdentityTransformer identity = new IdentityTransformer(); StringResult result = new StringResult(); Source source = StringSource.toSource(xml); identity.transform(source, result); assertNotNull(the(result)); }