StreamDataBodyPart extends FormDataBodyPart { protected FormDataContentDisposition buildContentDisposition() { FormDataContentDisposition.FormDataContentDispositionBuilder builder = FormDataContentDisposition.name(getName()); if (filename != null) { builder.fileName(filename); } else { builder.fileName(getName()); } return builder.build(); } StreamDataBodyPart();  StreamDataBodyPart(final String name, final InputStream streamEntity);  StreamDataBodyPart(final String name, final InputStream streamEntity, final String filename);  StreamDataBodyPart(final String name, final InputStream streamEntity,
                              final String filename,
                              final MediaType mediaType); @Override void setValue(final MediaType mediaType, final Object value); @Override void setValue(final String value); @Override void setEntity(final Object entity); void setStreamEntity(final InputStream streamEntity); void setStreamEntity(final InputStream streamEntity, MediaType mediaType); void setFilename(final String filename); InputStream getStreamEntity(); String getFilename();  }
@Test public void testBuildContentDisposition() { String name = "foo"; String expectedType = "form-data"; String expectedFilename = "bar.txt"; cut.setName(name); cut.setFilename(expectedFilename); ContentDisposition actual = cut.buildContentDisposition(); assertEquals(expectedType, actual.getType()); assertEquals(expectedFilename, actual.getFileName()); }