UploadedFileItem implements UploadedFile { public void cleanup() { item.delete(); } UploadedFileItem(FileItem item); @Override String getContentType(); @Override String getFileName(); @Override String getFilePath(); @Override long getSize(); @Override InputStream getStream(); @Override boolean isInMemory(); @Override void write(File file); void cleanup();  }
@Test public void cleanupCallsFileItemDelete() throws Exception { FileItem item = newMock(FileItem.class); UploadedFileItem uploadedFile = new UploadedFileItem(item); item.delete(); replay(); uploadedFile.cleanup(); verify(); }