InMemoryFileItem implements FileItem { @Override public void write(File file) throws Exception { throw new UnsupportedOperationException(); } InMemoryFileItem(String contentType, String fieldName, boolean isFormField, String fileName, int maxSize); @Override void delete(); @Override byte[] get(); @Override String getContentType(); @Override String getFieldName(); @Override InputStream getInputStream(); @Override String getName(); @Override OutputStream getOutputStream(); @Override long getSize(); @Override String getString(); @Override String getString(String encoding); @Override boolean isFormField(); @Override boolean isInMemory(); @Override void setFieldName(String name); @Override void setFormField(boolean state); @Override void write(File file); @Override FileItemHeaders getHeaders(); @Override void setHeaders(FileItemHeaders headers);  }
@Test(expected = UnsupportedOperationException.class) public void doesNotSupportWritingInFile() throws Exception { inMemoryFileItem.write(null); }