@Test @PrepareForTest @SuppressStaticInitializationFor public void testConvertDocumentToByteArray() throws Exception { Document document = DocumentHelper.createDocument(); Element root = document.addElement("ListExecutionContexts"); root.addAttribute("id", "2"); replayAll(); final byte[] array = tested.convertDocumentToByteArray(document); verifyAll(); assertNotNull(array); assertEquals(70, array.length); }
public byte[] convertDocumentToByteArray(Document document) throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); XMLWriter writer = new XMLWriter(stream); byte[] documentAsByteArray = null; try { writer.write(document); } finally { writer.close(); stream.flush(); stream.close(); } documentAsByteArray = stream.toByteArray(); return documentAsByteArray; }
AbstractXMLRequestCreatorBase { public byte[] convertDocumentToByteArray(Document document) throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); XMLWriter writer = new XMLWriter(stream); byte[] documentAsByteArray = null; try { writer.write(document); } finally { writer.close(); stream.flush(); stream.close(); } documentAsByteArray = stream.toByteArray(); return documentAsByteArray; } }
AbstractXMLRequestCreatorBase { public byte[] convertDocumentToByteArray(Document document) throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); XMLWriter writer = new XMLWriter(stream); byte[] documentAsByteArray = null; try { writer.write(document); } finally { writer.close(); stream.flush(); stream.close(); } documentAsByteArray = stream.toByteArray(); return documentAsByteArray; }  }
AbstractXMLRequestCreatorBase { public byte[] convertDocumentToByteArray(Document document) throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); XMLWriter writer = new XMLWriter(stream); byte[] documentAsByteArray = null; try { writer.write(document); } finally { writer.close(); stream.flush(); stream.close(); } documentAsByteArray = stream.toByteArray(); return documentAsByteArray; }  byte[] convertDocumentToByteArray(Document document); final byte[] createRequest(String... params); }
AbstractXMLRequestCreatorBase { public byte[] convertDocumentToByteArray(Document document) throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); XMLWriter writer = new XMLWriter(stream); byte[] documentAsByteArray = null; try { writer.write(document); } finally { writer.close(); stream.flush(); stream.close(); } documentAsByteArray = stream.toByteArray(); return documentAsByteArray; }  byte[] convertDocumentToByteArray(Document document); final byte[] createRequest(String... params);  }