I am using JUnit for testing of Daoimpl. In one of the cases, I need to give an input which is a multipart file. I searched the internet and found that mockmultipartfile is used, but didn't find any example. Please provide me one for better understanding.
I am using spring and JUnit 4.11
I have done the multipart file as a input for junit by using [MockMultipartFile].
FileInputStream inputFile = new FileInputStream( "path of the file");
MockMultipartFile file = new MockMultipartFile("file", "NameOfTheFile", "multipart/form-data", inputFile);
now use the file input as multipart file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With