I am trying to write a unit test for handling a file upload controller using Spring 3. Now if I send the image over to my service method through the controller everything wo
And if none of the solutions above work for you as it happened for me :) simply ditch the DiskFileItem and use the solution bellow:
final File fileToUpload = new File("src/test/resources/files/test.txt");
final MultiValueMap request = new LinkedMultiValueMap();
request.add("file", new FileSystemResource(fileToUpload.getAbsolutePath()));