public void testInputStream() throws Exception { ByteArrayDataSource bads = new ByteArrayDataSource(EXAMPLE_XML.getBytes(), "text/xml", "name"); ByteArrayOutputStream out = new ByteArrayOutputStream(); out.write(bads.getBytes()); out.flush(); assertEquals("XML", out.toString(), EXAMPLE_XML); }
public void testOutputStream() throws Exception { ByteArrayDataSource bads = new ByteArrayDataSource(EXAMPLE_XML.getBytes(), "text/xml", "name"); try { bads.getOutputStream(); fail("getOutputStream should not be supported"); } catch (Exception e) {; } }
public void testName() throws Exception { ByteArrayDataSource bads = new ByteArrayDataSource(EXAMPLE_XML.getBytes(), "text/xml", "name"); assertEquals("name", "name", bads.getName()); }