@Test public void testCreateFDBP() throws Exception { FileDataBodyPart fdbp = (FileDataBodyPart) bodyPart; assertNull(fdbp.getFormDataContentDisposition()); assertNull(fdbp.getName()); assertNull(fdbp.getValue()); assertTrue(fdbp.isSimple()); String name; File file = new File("pom.xml"); name = "xml"; fdbp = new FileDataBodyPart(name, file); MediaType expectedType = MediaType.APPLICATION_XML_TYPE; checkEntityAttributes(name, fdbp, file, expectedType); fdbp.setName(name); checkEntityAttributes(name, fdbp, file, expectedType); fdbp.setFileEntity(file); checkEntityAttributes(name, fdbp, file, expectedType); fdbp = new FileDataBodyPart(name, file, expectedType); checkEntityAttributes(name, fdbp, file, expectedType); fdbp.setFileEntity(file, expectedType); checkEntityAttributes(name, fdbp, file, expectedType); file = new File("pom.png"); name = "png"; fdbp = new FileDataBodyPart("png", file); expectedType = DefaultMediaTypePredictor.CommonMediaTypes.PNG.getMediaType(); checkEntityAttributes(name, fdbp, file, expectedType); file = new File("pom.zip"); fdbp = new FileDataBodyPart(name, file); expectedType = DefaultMediaTypePredictor.CommonMediaTypes.ZIP.getMediaType(); checkEntityAttributes(name, fdbp, file, expectedType); file = new File("pom.avi"); fdbp = new FileDataBodyPart(name, file); expectedType = DefaultMediaTypePredictor.CommonMediaTypes.AVI.getMediaType(); checkEntityAttributes(name, fdbp, file, expectedType); }
public void setFileEntity(final File fileEntity) { this.setFileEntity(fileEntity, predictMediaType()); }
FileDataBodyPart extends FormDataBodyPart { public void setFileEntity(final File fileEntity) { this.setFileEntity(fileEntity, predictMediaType()); } }
FileDataBodyPart extends FormDataBodyPart { public void setFileEntity(final File fileEntity) { this.setFileEntity(fileEntity, predictMediaType()); } FileDataBodyPart();  FileDataBodyPart(final String name, final File fileEntity);  FileDataBodyPart(final String name, final File fileEntity, final MediaType mediaType); }
FileDataBodyPart extends FormDataBodyPart { public void setFileEntity(final File fileEntity) { this.setFileEntity(fileEntity, predictMediaType()); } FileDataBodyPart();  FileDataBodyPart(final String name, final File fileEntity);  FileDataBodyPart(final String name, final File fileEntity, final MediaType mediaType); File getFileEntity(); @Override void setValue(final MediaType mediaType, final Object value); @Override void setEntity(final Object entity); void setFileEntity(final File fileEntity); void setFileEntity(final File fileEntity, final MediaType mediaType); MediaTypePredictor getPredictor(); void setPredictor(MediaTypePredictor predictor); }
FileDataBodyPart extends FormDataBodyPart { public void setFileEntity(final File fileEntity) { this.setFileEntity(fileEntity, predictMediaType()); } FileDataBodyPart();  FileDataBodyPart(final String name, final File fileEntity);  FileDataBodyPart(final String name, final File fileEntity, final MediaType mediaType); File getFileEntity(); @Override void setValue(final MediaType mediaType, final Object value); @Override void setEntity(final Object entity); void setFileEntity(final File fileEntity); void setFileEntity(final File fileEntity, final MediaType mediaType); MediaTypePredictor getPredictor(); void setPredictor(MediaTypePredictor predictor);  }