file type need to be
org.springframework.web.multipart.MultipartFile
. This is the super interface above
CommonsMultiPartFile
and
MockMultipartFile
. If you have done this, then you can create a mock of the multipart file itself with an mock object that is provided by spring, just like below
:
MockMultipartFile mockMultipartFile = new MockMultipartFile(String name, String originalFilename, String contentType, byte[] content);
you can get more information from http://stackoverflow.com/questions/8799378/how-to-write-unit-test-for-commonsmultipartfile-with-mock-in-spring