XmlHelper { @Deprecated public static XmlUtils createXmlUtils(AdaptrisMessage msg) throws CoreException { return createXmlUtils(msg, null); }  @Deprecated static XmlUtils createXmlUtils(AdaptrisMessage msg); @Deprecated static XmlUtils createXmlUtils(AdaptrisMessage msg, NamespaceContext ctx); static XmlUtils createXmlUtils(AdaptrisMessage msg, NamespaceContext ctx, DocumentBuilderFactoryBuilder builder); @Deprecated static Document createDocument(AdaptrisMessage msg); @Deprecated static Document createDocument(AdaptrisMessage msg, boolean namespaceAware); static Document createDocument(AdaptrisMessage msg, DocumentBuilderFactoryBuilder builder); static Document createDocument(AdaptrisMessage msg, DocumentBuilderFactoryBuilder builder, boolean newDocOnFailure); @Deprecated static Document createDocument(AdaptrisMessage msg, NamespaceContext namespaceContext); @Deprecated static Document createDocument(String s); @Deprecated static Document createDocument(String s, NamespaceContext namespaceContext); @Deprecated static Document createDocument(String s, boolean namespaceAware); static Document createDocument(String s, DocumentBuilderFactoryBuilder builder); static Document createDocument(String s, DocumentBuilderFactoryBuilder builder, boolean newDocOnFailure); static Document createDocument(InputStream in, DocumentBuilderFactoryBuilder builder); static Document createDocument(InputStream in, DocumentBuilderFactoryBuilder builder, boolean newDocOnFailure); static String safeElementName(String input, String defaultIfBlank); static String stripIllegalXmlCharacters(String input); static void writeXmlDocument(Document doc, AdaptrisMessage msg, String encoding); static void writeXmlDocument(Document doc, AdaptrisMessage msg, String encoding, Transformer serializer); static String getXmlEncoding(AdaptrisMessage msg, String enc); static final String FALLBACK_TRANSFORMER_FACTORY_IMPL; }
@Test public void testCreateXmlUtils() throws Exception { assertNotNull(createXmlUtils(AdaptrisMessageFactory.getDefaultInstance().newMessage(EXAMPLE_XML))); assertNotNull(createXmlUtils(AdaptrisMessageFactory.getDefaultInstance().newMessage(EXAMPLE_XML), DocumentBuilderFactoryBuilderTest.createNamespaceContext())); assertNotNull(XmlHelper.createXmlUtils(AdaptrisMessageFactory.getDefaultInstance().newMessage(EXAMPLE_XML), DocumentBuilderFactoryBuilderTest.createNamespaceContext(), null)); }
@Test(expected = CoreException.class) public void testXmlUtilsInvalidXmlString() throws Exception { createXmlUtils(AdaptrisMessageFactory.getDefaultInstance().newMessage("AAAAAAAA")); }
@Test(expected = CoreException.class) public void testXmlUtilsBrokenInput() throws Exception { AdaptrisMessage msg = mock(AdaptrisMessage.class); doThrow(new IOException()).when(msg).getInputStream(); createXmlUtils(msg); }