FileDataBodyPart extends FormDataBodyPart { @Override public void setEntity(final Object entity) throws UnsupportedOperationException { throw new UnsupportedOperationException("It is unsupported, please use setFileEntity instead!"); } 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);  }
@Override @Test public void testEntity() { try { bodyPart.setEntity("foo bar baz"); } catch (UnsupportedOperationException exception) { } }