@Test public void shouldReturnContentOfString() throws IOException { Part part = new StringPart(name, content); ByteArrayOutputStream out = new ByteArrayOutputStream(); InputStream is = part.getContent(); PartTestUtils.readStream(is, out); String result = new String(out.toByteArray()); assertThat(result, is(content)); }
@Override public InputStream getContent() throws IOException { byte[] bytes = getBytesFromContent(); if (bytes == null) { return null; } InputStream is = new ByteArrayInputStream(bytes); return is; }
StringPart extends AbstractPart { @Override public InputStream getContent() throws IOException { byte[] bytes = getBytesFromContent(); if (bytes == null) { return null; } InputStream is = new ByteArrayInputStream(bytes); return is; } }
StringPart extends AbstractPart { @Override public InputStream getContent() throws IOException { byte[] bytes = getBytesFromContent(); if (bytes == null) { return null; } InputStream is = new ByteArrayInputStream(bytes); return is; } StringPart(String name, String content);  StringPart(String name, String content, String charset);  StringPart(String name, String content, String charset, ContentType contentType); }
StringPart extends AbstractPart { @Override public InputStream getContent() throws IOException { byte[] bytes = getBytesFromContent(); if (bytes == null) { return null; } InputStream is = new ByteArrayInputStream(bytes); return is; } StringPart(String name, String content);  StringPart(String name, String content, String charset);  StringPart(String name, String content, String charset, ContentType contentType); @Override ContentType getContentType(); @Override InputStream getContent(); }
StringPart extends AbstractPart { @Override public InputStream getContent() throws IOException { byte[] bytes = getBytesFromContent(); if (bytes == null) { return null; } InputStream is = new ByteArrayInputStream(bytes); return is; } StringPart(String name, String content);  StringPart(String name, String content, String charset);  StringPart(String name, String content, String charset, ContentType contentType); @Override ContentType getContentType(); @Override InputStream getContent();  }